]> Kevux Git Server - fll/commitdiff
Cleanup: further utilize static stringss and correct the FSS Extended read function...
authorKevin Day <thekevinday@gmail.com>
Sun, 13 Dec 2020 04:20:39 +0000 (22:20 -0600)
committerKevin Day <thekevinday@gmail.com>
Sun, 13 Dec 2020 04:20:39 +0000 (22:20 -0600)
level_0/f_path/c/path-common.h
level_0/f_path/c/path.c
level_1/fl_directory/c/directory.c
level_1/fl_directory/c/private-directory.c
level_1/fl_environment/c/environment.c
level_1/fl_fss/c/fss_basic.h
level_1/fl_fss/c/fss_extended.h
level_2/fll_file/c/private-file.c
level_3/fake/c/private-build.c
level_3/fake/c/private-make.c

index 8fd92ea617618a85111ddd440e53078b22b98e1b..7177cde5ba8f5ac8d6e501c99f3a2bdfa652621e 100644 (file)
@@ -55,6 +55,17 @@ extern "C" {
   #define f_path_present_working_old_length 6
 
   #define f_path_max PATH_MAX
+
+  const static f_string_t f_path_separator_s = f_path_separator;
+  const static f_string_t f_path_separator_current_s = f_path_separator_current;
+  const static f_string_t f_path_separator_variable_s = f_path_separator_variable;
+
+  #define f_path_extension_separator_s f_path_separator_current_s
+
+  const static f_string_t f_path_environment_s = f_path_environment;
+  const static f_string_t f_path_home_wildcard_s = f_path_home_wildcard;
+  const static f_string_t f_path_present_working_s = f_path_present_working;
+  const static f_string_t f_path_present_working_old_s = f_path_present_working_old;
 #endif // _di_f_path_defines_
 
 #ifdef __cplusplus
index e7ad0882d6284632e30d5a169498a17251e9a21e..1429263075428af526dedac92ad4c27b5b85e879 100644 (file)
@@ -99,7 +99,7 @@ extern "C" {
 
     for (f_string_length_t i = 0; i < length; i++) {
 
-      if (path[i] == f_path_separator[0]) {
+      if (path[i] == f_path_separator_s[0]) {
         return F_true;
       }
     } // for
index 0e0ce03ce8651b4dda0ea2fb83d06cd639621b4d..e8447cfa3305badb92914625f4c20e4fef570705 100644 (file)
@@ -28,7 +28,7 @@ extern "C" {
 
       for (; path[at_path]; ++at_path) {
 
-        if (at_path && path[at_path] == f_path_separator[0]) {
+        if (at_path && path[at_path] == f_path_separator_s[0]) {
           memcpy(tree, path + at_tree, at_path - at_tree);
           tree[at_path] = 0;
 
@@ -99,7 +99,7 @@ extern "C" {
       for (; i > 0; i--, static_source.used--) {
 
         if (!source[i - 1]) continue;
-        if (source[i - 1] == f_path_separator[0]) continue;
+        if (source[i - 1] == f_path_separator_s[0]) continue;
 
         break;
       } // for
@@ -109,7 +109,7 @@ extern "C" {
       for (; i > 0; i--, static_destination.used--) {
 
         if (!destination[i - 1]) continue;
-        if (destination[i - 1] == f_path_separator[0]) continue;
+        if (destination[i - 1] == f_path_separator_s[0]) continue;
 
         break;
       } // for
@@ -153,7 +153,7 @@ extern "C" {
       for (; i > 0; i--, static_source.used--) {
 
         if (!source[i - 1]) continue;
-        if (source[i - 1] == f_path_separator[0]) continue;
+        if (source[i - 1] == f_path_separator_s[0]) continue;
 
         break;
       } // for
@@ -163,7 +163,7 @@ extern "C" {
       for (; i > 0; i--, static_destination.used--) {
 
         if (!destination[i - 1]) continue;
-        if (destination[i - 1] == f_path_separator[0]) continue;
+        if (destination[i - 1] == f_path_separator_s[0]) continue;
 
         break;
       } // for
@@ -221,7 +221,7 @@ extern "C" {
       for (; i > 0; i--, static_source.used--) {
 
         if (!source[i - 1]) continue;
-        if (source[i - 1] == f_path_separator[0]) continue;
+        if (source[i - 1] == f_path_separator_s[0]) continue;
 
         break;
       } // for
@@ -231,7 +231,7 @@ extern "C" {
       for (; i > 0; i--, static_destination.used--) {
 
         if (!destination[i - 1]) continue;
-        if (destination[i - 1] == f_path_separator[0]) continue;
+        if (destination[i - 1] == f_path_separator_s[0]) continue;
 
         break;
       } // for
@@ -275,7 +275,7 @@ extern "C" {
       for (; i > 0; i--, static_source.used--) {
 
         if (!source[i - 1]) continue;
-        if (source[i - 1] == f_path_separator[0]) continue;
+        if (source[i - 1] == f_path_separator_s[0]) continue;
 
         break;
       } // for
@@ -285,7 +285,7 @@ extern "C" {
       for (; i > 0; i--, static_destination.used--) {
 
         if (!destination[i - 1]) continue;
-        if (destination[i - 1] == f_path_separator[0]) continue;
+        if (destination[i - 1] == f_path_separator_s[0]) continue;
 
         break;
       } // for
@@ -346,7 +346,7 @@ extern "C" {
       }
 
       if (first_nulless) {
-        if (path->string[i] == f_path_separator[0]) {
+        if (path->string[i] == f_path_separator_s[0]) {
           if (null_terminated) {
             path->string[i + 1] = 0;
             path->used = i + 2;
@@ -373,7 +373,7 @@ extern "C" {
             return status;
           }
 
-          if (path->string[j] != f_path_separator[0]) {
+          if (path->string[j] != f_path_separator_s[0]) {
             i = j + 1;
             break;
           }
index e62fadb5ae26999d5c1f8e2dd4375d6a33c6bb2a..1cc8a80470cc30b59ac9cff271cf9b41d5159ef3 100644 (file)
@@ -65,10 +65,10 @@ extern "C" {
       memcpy(path_destination_sub, destination.string, destination.used);
       memcpy(path_destination_sub + destination.used + 1, listing.directory.array[i].string, listing.directory.array[i].used);
 
-      path_source_sub[source.used] = f_path_separator[0];
+      path_source_sub[source.used] = f_path_separator_s[0];
       path_source_sub[source_sub.used] = 0;
 
-      path_destination_sub[destination.used] = f_path_separator[0];
+      path_destination_sub[destination.used] = f_path_separator_s[0];
       path_destination_sub[destination_sub.used] = 0;
 
       source_sub.string = path_source_sub;
@@ -139,12 +139,12 @@ extern "C" {
 
     memcpy(path_source, source.string, source.used);
     memcpy(path_source + source.used + 1, file.string, file.used);
-    path_source[source.used] = f_path_separator[0];
+    path_source[source.used] = f_path_separator_s[0];
     path_source[source.used + file.used + 1] = 0;
 
     memcpy(path_destination, destination.string, destination.used);
     memcpy(path_destination + destination.used + 1, file.string, file.used);
-    path_destination[destination.used] = f_path_separator[0];
+    path_destination[destination.used] = f_path_separator_s[0];
     path_destination[destination.used + file.used + 1] = 0;
 
     f_status_t status = f_file_clone(path_source, path_destination, role, recurse.size_block, recurse.exclusive);
@@ -275,10 +275,10 @@ extern "C" {
       memcpy(path_destination_sub, destination.string, destination.used);
       memcpy(path_destination_sub + destination.used + 1, listing.directory.array[i].string, listing.directory.array[i].used);
 
-      path_source_sub[source.used] = f_path_separator[0];
+      path_source_sub[source.used] = f_path_separator_s[0];
       path_source_sub[source_sub.used] = 0;
 
-      path_destination_sub[destination.used] = f_path_separator[0];
+      path_destination_sub[destination.used] = f_path_separator_s[0];
       path_destination_sub[destination_sub.used] = 0;
 
       source_sub.string = path_source_sub;
@@ -335,12 +335,12 @@ extern "C" {
 
     memcpy(path_source, source.string, source.used);
     memcpy(path_source + source.used + 1, file.string, file.used);
-    path_source[source.used] = f_path_separator[0];
+    path_source[source.used] = f_path_separator_s[0];
     path_source[source.used + file.used + 1] = 0;
 
     memcpy(path_destination, destination.string, destination.used);
     memcpy(path_destination + destination.used + 1, file.string, file.used);
-    path_destination[destination.used] = f_path_separator[0];
+    path_destination[destination.used] = f_path_separator_s[0];
     path_destination[destination.used + file.used + 1] = 0;
 
     f_status_t status = f_file_copy(path_source, path_destination, mode, recurse.size_block, recurse.exclusive);
@@ -603,7 +603,7 @@ extern "C" {
             return status;
           }
 
-          if (destination->string[i] == f_path_separator[0]) {
+          if (destination->string[i] == f_path_separator_s[0]) {
             if (i - 1 > 0) {
               for (j = i - 1; j > 0; j--) {
                 if (!destination->string[j]) continue;
@@ -617,7 +617,7 @@ extern "C" {
                   return status;
                 }
 
-                if (destination->string[j] == f_path_separator[0]) {
+                if (destination->string[j] == f_path_separator_s[0]) {
                   destination->used = j + 1;
                 }
                 else {
@@ -635,7 +635,7 @@ extern "C" {
         } // for
 
         if (destination->used > 0 && !i) {
-          if (destination->string[0] != 0 && destination->string[0] != f_path_separator[0]) {
+          if (destination->string[0] != 0 && destination->string[0] != f_path_separator_s[0]) {
             separator_prepend = F_true;
             total++;
           }
@@ -654,7 +654,7 @@ extern "C" {
           return status;
         }
 
-        if (source[i] == f_path_separator[0]) {
+        if (source[i] == f_path_separator_s[0]) {
           if (!separator_prepend && destination->used > 0) {
             destination->used--;
           }
@@ -672,7 +672,7 @@ extern "C" {
                 return status;
               }
 
-              if (source[j] == f_path_separator[0]) {
+              if (source[j] == f_path_separator_s[0]) {
                 length_truncated = j + 1;
               }
               else {
@@ -689,7 +689,7 @@ extern "C" {
         break;
       } // for
 
-      if (!i && source[0] != f_path_separator[0]) {
+      if (!i && source[0] != f_path_separator_s[0]) {
         separator_append = F_true;
         total++;
       }
@@ -708,7 +708,7 @@ extern "C" {
 
         start = i;
 
-        if (source[0] == f_path_separator[0]) {
+        if (source[0] == f_path_separator_s[0]) {
           if (i + 1 < length_truncated) {
             for (j = i + 1; j < length_truncated; j++) {
               if (!source[j]) continue;
@@ -722,7 +722,7 @@ extern "C" {
                 return status;
               }
 
-              if (source[j] == f_path_separator[0]) {
+              if (source[j] == f_path_separator_s[0]) {
                 start = j;
               }
               else {
@@ -748,7 +748,7 @@ extern "C" {
     }
 
     if (separator_prepend) {
-      destination->string[destination->used] = f_path_separator[0];
+      destination->string[destination->used] = f_path_separator_s[0];
       destination->used++;
       total--;
     }
@@ -761,11 +761,11 @@ extern "C" {
 
     if (separator_append) {
       if (terminated_null) {
-        destination->string[destination->used - 2] = f_path_separator[0];
+        destination->string[destination->used - 2] = f_path_separator_s[0];
         destination->string[destination->used - 1] = 0;
       }
       else {
-        destination->string[destination->used - 1] = f_path_separator[0];
+        destination->string[destination->used - 1] = f_path_separator_s[0];
       }
     }
     else if (terminated_null) {
index 1670a73d61a57bac99764839cdab7ac03b4d09e2..f6416d2415aefa6304735b5e33e04a02753081bd 100644 (file)
@@ -50,7 +50,7 @@ extern "C" {
         total = i - first;
 
         if (total > 0) {
-          if (path[i - 1] == f_path_separator[0]) {
+          if (path[i - 1] == f_path_separator_s[0]) {
             f_macro_string_dynamic_t_new(status, part, total);
             if (F_status_is_error(status)) return status;
 
@@ -60,7 +60,7 @@ extern "C" {
             f_macro_string_dynamic_t_new(status, part, total + 1);
             if (F_status_is_error(status)) return status;
 
-            part.string[total] = f_path_separator[0];
+            part.string[total] = f_path_separator_s[0];
             part.used = total + 1;
           }
 
@@ -137,11 +137,11 @@ extern "C" {
             part.used++;
           } // for
 
-          if (part.string[part.used - 1] != f_path_separator[0]) {
+          if (part.string[part.used - 1] != f_path_separator_s[0]) {
             f_macro_string_dynamic_t_resize(status, part, total + 1);
             if (F_status_is_error(status)) return status;
 
-            part.string[part.used] = f_path_separator[0];
+            part.string[part.used] = f_path_separator_s[0];
             part.used++;
           }
         }
@@ -202,7 +202,7 @@ extern "C" {
           total = last - i;
 
           if (total > 0) {
-            if (path[j + total] == f_path_separator[0]) {
+            if (path[j + total] == f_path_separator_s[0]) {
               f_macro_string_dynamic_t_new(status, part, total);
               if (F_status_is_error(status)) return status;
 
@@ -212,7 +212,7 @@ extern "C" {
               f_macro_string_dynamic_t_new(status, part, total + 1);
               if (F_status_is_error(status)) return status;
 
-              part.string[total] = f_path_separator[0];
+              part.string[total] = f_path_separator_s[0];
               part.used = total + 1;
             }
 
@@ -227,7 +227,7 @@ extern "C" {
           total = last - j;
 
           if (total > 0) {
-            if (path[last - 1] == f_path_separator[0]) {
+            if (path[last - 1] == f_path_separator_s[0]) {
               f_macro_string_dynamic_t_new(status, part, total);
               if (F_status_is_error(status)) return status;
 
@@ -238,7 +238,7 @@ extern "C" {
               if (F_status_is_error(status)) return status;
 
               part.used = total + 1;
-              part.string[total] = f_path_separator[0];
+              part.string[total] = f_path_separator_s[0];
             }
 
             memcpy(part.string, path, total);
@@ -307,11 +307,11 @@ extern "C" {
               part.used++;
             } // for
 
-            if (part.string[part.used - 1] != f_path_separator[0]) {
+            if (part.string[part.used - 1] != f_path_separator_s[0]) {
               f_macro_string_dynamic_t_resize(status, part, total + 1);
               if (F_status_is_error(status)) return status;
 
-              part.string[part.used] = f_path_separator[0];
+              part.string[part.used] = f_path_separator_s[0];
               part.used++;
             }
           }
@@ -332,11 +332,11 @@ extern "C" {
             part.used++;
           } // for
 
-          if (part.string[part.used - 1] != f_path_separator[0]) {
+          if (part.string[part.used - 1] != f_path_separator_s[0]) {
             f_macro_string_dynamic_t_resize(status, part, total + 1);
             if (F_status_is_error(status)) return status;
 
-            part.string[part.used - 1] = f_path_separator[0];
+            part.string[part.used - 1] = f_path_separator_s[0];
             part.used++;
           }
         }
index ab4613c55469d6b0cf3b88ee24f593df38f5bec0..d3fedfa9efdf6b45d2a3de3d027ed462c6c5bbd1 100644 (file)
@@ -53,6 +53,7 @@ extern "C" {
  *
  * @return
  *   FL_fss_found_object on success and object was found (start location is at end of object).
+ *   FL_fss_found_object_content_not on success but object ended at the line so there can be no content.
  *   FL_fss_found_object_not on success and no object was found (start location is after character designating this is not an object).
  *   F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed).
  *   F_none_stop on success after reaching stopping point (a valid object is not yet confirmed).
index 4c6733faa4d22c3e290047933b279de2d9ba436d..1b9d02aa7a87c78bedb26fc17080c6aa9bd424b6 100644 (file)
@@ -53,6 +53,7 @@ extern "C" {
  *
  * @return
  *   FL_fss_found_object on success and object was found (start location is at end of object).
+ *   FL_fss_found_object_content_not on success but object ended at the line so there can be no content.
  *   FL_fss_found_object_not on success and no object was found (start location is after character designating this is not an object).
  *   F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed).
  *   F_none_stop on success after reaching stopping point (a valid object is not yet confirmed).
index d73fca352c63d3b9feacca265eb56c2274532851..93287af399201b470fa6982cb57407c77fd7975a 100644 (file)
@@ -54,7 +54,7 @@ extern "C" {
           memcpy(path_sub, path, path_length);
           memcpy(path_sub + path_length + 1, list[i]->array[j].string, list[i]->array[j].used);
 
-          path_sub[path_length] = f_path_separator[0];
+          path_sub[path_length] = f_path_separator_s[0];
           path_sub[length] = 0;
 
           status = f_file_mode_set(path_sub, mode);
@@ -75,7 +75,7 @@ extern "C" {
       memcpy(path_sub, path, path_length);
       memcpy(path_sub + path_length + 1, listing.directory.array[i].string, listing.directory.array[i].used);
 
-      path_sub[path_length] = f_path_separator[0];
+      path_sub[path_length] = f_path_separator_s[0];
       path_sub[length] = 0;
 
       status = f_directory_exists(path_sub);
@@ -151,7 +151,7 @@ extern "C" {
           memcpy(path_sub, path, path_length);
           memcpy(path_sub + path_length + 1, list[i]->array[j].string, list[i]->array[j].used);
 
-          path_sub[path_length] = f_path_separator[0];
+          path_sub[path_length] = f_path_separator_s[0];
           path_sub[length] = 0;
 
           status = f_file_role_change(path_sub, uid, gid, dereference);
@@ -170,7 +170,7 @@ extern "C" {
       memcpy(path_sub, path, path_length);
       memcpy(path_sub + path_length + 1, listing.directory.array[i].string, listing.directory.array[i].used);
 
-      path_sub[path_length] = f_path_separator[0];
+      path_sub[path_length] = f_path_separator_s[0];
       path_sub[length] = 0;
 
       status = f_directory_exists(path_sub);
index 8691c8f61eca2f811da5e570dd6f9383d96358f7..87b08037b7f6c3644eb6876f597d48f284f858ac 100644 (file)
@@ -1123,7 +1123,7 @@ extern "C" {
             break;
           }
 
-          *status = fl_string_append_assure(f_path_separator, f_path_separator_length, &source_path);
+          *status = fl_string_append_assure(f_path_separator_s, f_path_separator_length, &source_path);
 
           if (F_status_is_error(*status)) {
             fll_error_print(data.error, F_status_set_fine(*status), "fl_string_append_assure", F_true);
@@ -1190,8 +1190,8 @@ extern "C" {
     {
       // add the guaranteed environment variables.
       const f_string_t variables_name[] = {
-        f_path_environment,
-        f_path_present_working
+        f_path_environment_s,
+        f_path_present_working_s
       };
 
       const f_string_length_t variables_length[] = {
@@ -2032,7 +2032,7 @@ extern "C" {
           }
 
           if (settings_single_type[i] == 2) {
-            *status = fl_string_append_assure(f_path_separator, f_path_separator_length, settings_single_destination[i]);
+            *status = fl_string_append_assure(f_path_separator_s, f_path_separator_length, settings_single_destination[i]);
             if (F_status_is_error(*status)) {
               fll_error_print(data.error, F_status_set_fine(*status), "fl_string_append_assure", F_true);
               break;
@@ -2445,7 +2445,7 @@ extern "C" {
           break;
         }
 
-        *status = fl_string_append_assure(f_path_separator, f_path_separator_length, &destination_path);
+        *status = fl_string_append_assure(f_path_separator_s, f_path_separator_length, &destination_path);
 
         if (F_status_is_error(*status)) {
           fll_error_print(data.error, F_status_set_fine(*status), "fl_string_append_assure", F_true);
index f2ed7aa7b5da33028d37a43554540804a09aef7a..1b984e0059a54beefcc312ba0d498aba6ce95225 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
           return F_true;
         }
 
-        if (data_make->path_cache.string[data_make->path.stack.array[0].used] == f_path_separator[0]) {
+        if (data_make->path_cache.string[data_make->path.stack.array[0].used] == f_path_separator_s[0]) {
           return F_true;
         }
       }
@@ -2383,7 +2383,7 @@ extern "C" {
 
         if (existing) {
           memcpy(destination + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used);
-          destination[arguments.array[total].used] = f_path_separator[0];
+          destination[arguments.array[total].used] = f_path_separator_s[0];
         }
 
         destination[destination_length] = 0;
@@ -2483,7 +2483,7 @@ extern "C" {
 
         if (existing) {
           memcpy(destination + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used);
-          destination[arguments.array[total].used] = f_path_separator[0];
+          destination[arguments.array[total].used] = f_path_separator_s[0];
         }
 
         destination[destination_length] = 0;
@@ -3419,7 +3419,7 @@ extern "C" {
 
         if (existing) {
           memcpy(destination + arguments.array[total].used + 1, arguments.array[i].string, arguments.array[i].used);
-          destination[arguments.array[total].used] = f_path_separator[0];
+          destination[arguments.array[total].used] = f_path_separator_s[0];
         }
 
         destination[destination_length] = 0;