]> Kevux Git Server - fll/commitdiff
Cleanup: Use the signal check functions in progams.
authorKevin Day <kevin@kevux.org>
Fri, 7 Jul 2023 03:35:31 +0000 (22:35 -0500)
committerKevin Day <kevin@kevux.org>
Fri, 7 Jul 2023 03:35:31 +0000 (22:35 -0500)
There already are signal check programs here.
Use those instead of manually performing the signal check actions.

level_3/iki_read/c/main/iki_read.c
level_3/iki_read/c/main/process.c
level_3/utf8/c/main/bytesequence.c
level_3/utf8/c/main/codepoint.c
level_3/utf8/c/main/process.c
level_3/utf8/c/main/utf8.c

index dd540fe91d54b052fd29b9d996b37329ea29ce0b..4bc798078ca22013b7c501c16eed303f1e7b17c5 100644 (file)
@@ -66,17 +66,7 @@ extern "C" {
 
       for (f_number_unsigned_t i = 0; i < main->setting.files.used; ++i) {
 
-        if (!((++main->program.signal_check) % iki_read_signal_check_d)) {
-          if (fll_program_standard_signal_received(&main->program)) {
-            fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
-
-            main->setting.state.status = F_status_set_error(F_interrupt);
-
-            break;
-          }
-
-          main->program.signal_check = 0;
-        }
+        if (iki_read_signal_check(main)) return;
 
         file.stream = 0;
         file.id = -1;
index a9d16db23ee06483c9899c9e6580a8a4c228ed8d..c54cb8f27de6ba391f4bf3fa0fe4c9b34dbfda1c 100644 (file)
@@ -327,19 +327,7 @@ extern "C" {
 
       for (i = 0; i < main->program.parameters.array[iki_read_parameter_name_e].values.used; ++i) {
 
-        if (!((++main->program.signal_check) % iki_read_signal_check_d)) {
-          if (fll_program_standard_signal_received(&main->program)) {
-            fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
-
-            f_string_dynamic_resize(0, &name);
-
-            main->setting.state.status = F_status_set_error(F_interrupt);
-
-            return;
-          }
-
-          main->program.signal_check = 0;
-        }
+        if (iki_read_signal_check(main)) return;
 
         index = main->program.parameters.array[iki_read_parameter_name_e].values.array[i];
         name.used = 0;
index 3795c92d21784d45b69d909dac645b1cf96957dd..f3e802d4b8993c078720d49951284b78c2ff1b4a 100644 (file)
@@ -79,17 +79,7 @@ extern "C" {
 
       for (i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.buffer.used; ) {
 
-        if (!((++main->program.signal_check) % utf8_signal_check_d)) {
-          if (fll_program_standard_signal_received(&main->program)) {
-            fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
-
-            main->setting.state.status = F_interrupt;
-
-            break;
-          }
-
-          main->program.signal_check = 0;
-        }
+        if (utf8_signal_check(main)) return;
 
         main->setting.state.status = F_none;
 
index 599731c6642ef2ba586b1466d7738660b94cd0cf..1b8d2ef4d3d83649fe2a13f08f7bccacc6f0bde1 100644 (file)
@@ -349,17 +349,7 @@ extern "C" {
 
       for (i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.buffer.used; ) {
 
-        if (!((++main->program.signal_check) % utf8_signal_check_d)) {
-          if (fll_program_standard_signal_received(&main->program)) {
-            fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
-
-            main->setting.state.status = F_status_set_error(F_interrupt);
-
-            break;
-          }
-
-          main->program.signal_check = 0;
-        }
+        if (utf8_signal_check(main)) return;
 
         main->setting.state.status = F_none;
 
index 78ec0695e51657db4681cd34983c58f45a0d541b..8e940c63955fbfca8922080abb319ba549a12e22 100644 (file)
@@ -26,17 +26,7 @@ extern "C" {
 
     for (; text.string[0] && F_status_is_error_not(main->setting.state.status); ) {
 
-      if (!((++main->program.signal_check) % utf8_signal_check_d)) {
-        if (fll_program_standard_signal_received(&main->program)) {
-          fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
-
-          main->setting.state.status = F_status_set_error(F_interrupt);
-
-          break;
-        }
-
-        main->program.signal_check = 0;
-      }
+      if (utf8_signal_check(main)) return;
 
       main->setting.state.status = F_none;
 
index f70ea2c50d370662b669b31bc5bcfac3e3bf8c55..4ef0b451e79ef62daab4f7285296aa22ae91b150 100644 (file)
@@ -77,15 +77,7 @@ extern "C" {
 
       for (f_number_unsigned_t i = 0; i < main->setting.path_files_from.used && F_status_is_error_not(main->setting.state.status); ++i) {
 
-        if (!((++main->program.signal_check) % utf8_signal_check_d)) {
-          if (fll_program_standard_signal_received(&main->program)) {
-            main->setting.state.status = F_status_set_error(F_interrupt);
-
-            break;
-          }
-
-          main->program.signal_check = 0;
-        }
+        if (utf8_signal_check(main)) return;
 
         utf8_print_data_section_header_file(&main->program.output, main->setting.path_files_from.array[i], i);
 
@@ -149,15 +141,7 @@ extern "C" {
     if (F_status_is_error_not(main->setting.state.status) && main->setting.remaining.used) {
       for (f_number_unsigned_t i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.remaining.used; ++i) {
 
-        if (!((++main->program.signal_check) % utf8_signal_check_d)) {
-          if (fll_program_standard_signal_received(&main->program)) {
-            main->setting.state.status = F_status_set_error(F_interrupt);
-
-            break;
-          }
-
-          main->program.signal_check = 0;
-        }
+        if (utf8_signal_check(main)) return;
 
         utf8_print_data_section_header_parameter(&main->program.output, i);