]> Kevux Git Server - fll/commitdiff
Cleanup: Use simpler logic for used > 0 check.
authorKevin Day <thekevinday@gmail.com>
Wed, 28 Apr 2021 04:20:08 +0000 (23:20 -0500)
committerKevin Day <thekevinday@gmail.com>
Wed, 28 Apr 2021 04:20:08 +0000 (23:20 -0500)
The logic fo checking if used > 0 can be made simpler by simply checking used.
(Given that used is always unsigned.)

level_3/fake/c/private-build.c
level_3/fake/c/private-fake.c
level_3/fake/c/private-make.c

index 3795fe5157c21a116058be85df62c0da87b45343..8985f209b9bbddc573acfe7011ca81aeed523ba0 100644 (file)
@@ -49,7 +49,7 @@ extern "C" {
       if (F_status_is_error(*status)) break;
     } // for
 
-    if (data.path_work.used > 0) {
+    if (data.path_work.used) {
       f_array_length_t length = 0;
 
       if (F_status_is_error_not(*status)) {
@@ -393,7 +393,7 @@ extern "C" {
 
     char directory_headers[directory_headers_length + 1];
 
-    if (data_build.setting.path_headers.used > 0) {
+    if (data_build.setting.path_headers.used) {
       memcpy(directory_headers, data.path_build_includes.string, data.path_build_includes.used);
       memcpy(directory_headers + data.path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used);
 
@@ -1560,7 +1560,7 @@ extern "C" {
       f_array_length_t j = 0;
 
       // if any mode is specified, the entire defaults is replaced.
-      if (data.mode.used > 0) {
+      if (data.mode.used) {
         modes = &data.mode;
       }
 
@@ -2044,7 +2044,7 @@ extern "C" {
       };
 
       for (uint8_t i = 0; i < 3; i++) {
-        if (destinations[i]->used > 0) continue;
+        if (destinations[i]->used) continue;
 
         *status = f_string_append_assure(sources[i], lengths[i], destinations[i]);
 
@@ -2587,7 +2587,7 @@ extern "C" {
 
         char directory_headers[directory_headers_length + 1];
 
-        if (data_build.setting.path_headers.used > 0) {
+        if (data_build.setting.path_headers.used) {
           memcpy(directory_headers, data->path_build_includes.string, data->path_build_includes.used);
           memcpy(directory_headers + data->path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used);
 
@@ -2724,7 +2724,7 @@ extern "C" {
     }
 
     // if project-specific library sources exist, then the -lproject_name needs to be added to the arguments.
-    if (F_status_is_error_not(*status) && data_build.setting.build_sources_library.used > 0) {
+    if (F_status_is_error_not(*status) && data_build.setting.build_sources_library.used) {
       f_array_length_t link_project_library_length = fake_build_parameter_library_link_file_length + data_build.setting.project_name.used;
 
       char link_project_library[link_project_library_length + 1];
index 3c32a70bed65b2e564e6daabcc5d41165d75cef9..da0180ff21b64aaddc4cf1192efb3f2a151cfebf 100644 (file)
@@ -388,7 +388,7 @@ extern "C" {
       } // for
     }
 
-    if (data->path_work.used > 0) {
+    if (data->path_work.used) {
       {
         f_string_dynamic_t * const parameters_value[] = {
           &data->path_work_includes,
@@ -1001,7 +1001,7 @@ extern "C" {
         return F_status_set_error(F_signal);
       }
 
-      if (parameters_value[i]->used > 0) {
+      if (parameters_value[i]->used) {
         memset(&directory_stat, 0, sizeof(struct stat));
 
         status = f_file_stat(parameters_value[i]->string, F_true, &directory_stat);
index 2a2695bba0bae596b0624108739d448a8536e178..dd74e8cf65297b7a709a7cbca8d79b07e9ad87d9 100644 (file)
@@ -4521,7 +4521,7 @@ extern "C" {
         return;
       }
 
-      if (arguments.used > 0) {
+      if (arguments.used) {
         const f_string_t if_type_strings[] = {
           fake_make_operation_argument_if_defined,
           fake_make_operation_argument_if_equal,