From 8bd1800bdbefc3733c12cc0dc6b540999c88fd35 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 14 May 2020 21:52:28 -0500 Subject: [PATCH] Cleanup: remove f_string_eos, use 0 instead I originally created f_string_eos, so that it could be potentially changed. In the case of basic strings, using 0 is simpler, more consistent, and safer. --- level_0/f_print/c/print.c | 6 +-- level_0/f_string/c/string.h | 9 +--- level_1/fl_color/c/color.c | 2 +- level_1/fl_fss/c/fss_basic.c | 4 +- level_1/fl_fss/c/fss_extended.c | 14 +++--- level_1/fl_print/c/print.c | 24 +++++----- level_1/fl_string/c/private-string.c | 38 ++++++++-------- level_1/fl_string/c/string.c | 52 +++++++++++----------- level_1/fl_utf/c/private-utf.c | 30 ++++++------- level_2/fll_execute/c/execute.c | 12 ++--- .../c/private-fss_basic_list_read.c | 12 ++--- .../c/private-fss_extended_list_read.c | 12 ++--- 12 files changed, 104 insertions(+), 111 deletions(-) diff --git a/level_0/f_print/c/print.c b/level_0/f_print/c/print.c index 438f384..eadb523 100644 --- a/level_0/f_print/c/print.c +++ b/level_0/f_print/c/print.c @@ -14,7 +14,7 @@ extern "C" { register f_string_length i = 0; for (; i < length; i++) { - if (string[i] != f_string_eos) { + if (string[i] != 0) { if (fputc(string[i], output) == 0) { return f_status_set_error(f_error_output); } @@ -34,7 +34,7 @@ extern "C" { register f_string_length i = 0; for (; i < buffer.used; i++) { - if (buffer.string[i] != f_string_eos) { + if (buffer.string[i] != 0) { if (fputc(buffer.string[i], output) == 0) { return f_status_set_error(f_error_output); } @@ -58,7 +58,7 @@ extern "C" { register f_string_length i = range.start; for (; i <= range.stop; i++) { - if (buffer.string[i] != f_string_eos) { + if (buffer.string[i] != 0) { if (fputc(buffer.string[i], output) == 0) { return f_status_set_error(f_error_output); } diff --git a/level_0/f_string/c/string.h b/level_0/f_string/c/string.h index e6fabd7..da96a44 100644 --- a/level_0/f_string/c/string.h +++ b/level_0/f_string/c/string.h @@ -34,13 +34,6 @@ extern "C" { #endif // _en_BUG_strnlen_ /** - * Define the end of string character. - */ -#ifndef _di_f_string_has_eos_ - #define f_string_eos '\0' -#endif // _di_f_string_has_eos_ - -/** * Define the end of line character. * FLL forbids '\r' and '\r\n' as end of line characters, \r will be silently ignored. */ @@ -83,7 +76,7 @@ extern "C" { typedef char *f_string; #define f_string_max_size f_type_number_size_unsigned - #define f_string_initialize f_string_eos + #define f_string_initialize 0 #define f_macro_string_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_string), length) #define f_macro_string_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_string), length) diff --git a/level_1/fl_color/c/color.c b/level_1/fl_color/c/color.c index ab97771..51930e5 100644 --- a/level_1/fl_color/c/color.c +++ b/level_1/fl_color/c/color.c @@ -107,7 +107,7 @@ extern "C" { buffer->used += string_size; // do not forget the EOS - buffer->string[buffer->used] = f_string_eos; + buffer->string[buffer->used] = 0; return f_none; } diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index d851c00..4efa1a7 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -50,7 +50,7 @@ extern "C" { } // handle quote support - int8_t quoted = f_string_eos; + int8_t quoted = 0; // identify where the object begins if (buffer->string[location->start] == f_fss_delimit_slash) { @@ -120,7 +120,7 @@ extern "C" { } // identify where the object ends - if (quoted == f_string_eos) { + if (quoted == 0) { status = f_none; while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = fl_fss_is_space(*buffer, *location)) == f_false) { status = fl_fss_increment_buffer(*buffer, location, 1); diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index 546da03..6593be7 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -50,7 +50,7 @@ extern "C" { } // handle quote support - int8_t quoted = f_string_eos; + int8_t quoted = 0; // identify where the object begins if (buffer->string[location->start] == f_fss_delimit_slash) { @@ -126,7 +126,7 @@ extern "C" { } // identify where the object ends - if (quoted == f_string_eos) { + if (quoted == 0) { status = f_none; while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = fl_fss_is_graph(*buffer, *location)) == f_true) { status = fl_fss_increment_buffer(*buffer, location, 1); @@ -389,7 +389,7 @@ extern "C" { } bool has_delimit = f_false; - int8_t quoted = f_string_eos; + int8_t quoted = 0; bool continue_main_loop = f_false; @@ -397,7 +397,7 @@ extern "C" { f_array_length already_used = found->used; while (location->start <= location->stop && location->start < buffer->used) { - quoted = f_string_eos; + quoted = 0; if (found->used >= found->size) { f_macro_fss_content_resize(status, (*found), found->size + f_fss_default_allocation_step); @@ -502,7 +502,7 @@ extern "C" { } // identify where the content ends - if (quoted == f_string_eos) { + if (quoted == 0) { status = f_none; while (buffer->string[location->start] == f_fss_delimit_placeholder || (status = fl_fss_is_graph(*buffer, *location)) == f_true) { status = fl_fss_increment_buffer(*buffer, location, 1); @@ -1039,7 +1039,7 @@ extern "C" { #endif // _di_level_1_parameter_checking_ f_status status = f_none; - int8_t quoted = f_string_eos; + int8_t quoted = 0; f_string_range buffer_position = f_string_range_initialize; f_string_length start_position = 0; @@ -1175,7 +1175,7 @@ extern "C" { if (f_status_is_error(status)) return status; } // while - if (quoted != f_string_eos) { + if (quoted != 0) { while (location->start <= location->stop && location->start < content.used) { if (content.string[location->start] == f_fss_delimit_slash) { f_string_length slash_count = 1; diff --git a/level_1/fl_print/c/print.c b/level_1/fl_print/c/print.c index 27a1435..a332681 100644 --- a/level_1/fl_print/c/print.c +++ b/level_1/fl_print/c/print.c @@ -31,7 +31,7 @@ extern "C" { } // for for (; i < length; i += f_macro_utf_byte_width(string[i])) { - if (string[i] == f_string_eos) continue; + if (string[i] == 0) continue; width_max = (length - i) + 1; status = f_utf_is_whitespace(string + i, width_max); @@ -66,7 +66,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == f_false) { for (; i < j; i++) { - if (string[i] == f_string_eos) continue; + if (string[i] == 0) continue; if (fputc(string[i], output) == 0) { return f_status_set_error(f_error_output); @@ -117,7 +117,7 @@ extern "C" { } // for for (; i < buffer.used; i += f_macro_utf_byte_width(buffer.string[i])) { - if (buffer.string[i] == f_string_eos) continue; + if (buffer.string[i] == 0) continue; width_max = (buffer.used - i) + 1; status = f_utf_is_whitespace(buffer.string + i, width_max); @@ -152,7 +152,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == f_false) { for (; i < j; i++) { - if (buffer.string[i] == f_string_eos) continue; + if (buffer.string[i] == 0) continue; if (fputc(buffer.string[i], output) == 0) { return f_status_set_error(f_error_output); @@ -208,7 +208,7 @@ extern "C" { } // for for (uint8_t width_i = f_macro_utf_byte_width(buffer.string[i]); i <= range.stop; i += width_i) { - if (buffer.string[i] == f_string_eos) { + if (buffer.string[i] == 0) { width_i = 1; continue; } @@ -248,7 +248,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == f_false) { for (; i <= j; i += width_i) { - if (buffer.string[i] == f_string_eos) { + if (buffer.string[i] == 0) { width_i = 1; continue; } @@ -307,7 +307,7 @@ extern "C" { } // for for (; i < length; i++) { - if (string[i] == f_string_eos) continue; + if (string[i] == 0) continue; status = f_utf_character_is_whitespace(string[i]); @@ -340,7 +340,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == f_false) { for (; i < j; i++) { - if (string[i] == f_string_eos) continue; + if (string[i] == 0) continue; if (fputc(string[i], output) == 0) { return f_status_set_error(f_error_output); @@ -389,7 +389,7 @@ extern "C" { } // for for (; i < buffer.used; i++) { - if (buffer.string[i] == f_string_eos) continue; + if (buffer.string[i] == 0) continue; status = f_utf_character_is_whitespace(buffer.string[i]); @@ -422,7 +422,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == f_false) { for (; i < j; i++) { - if (buffer.string[i] == f_string_eos) continue; + if (buffer.string[i] == 0) continue; if (fputc(buffer.string[i], output) == 0) { return f_status_set_error(f_error_output); @@ -475,7 +475,7 @@ extern "C" { } // for for (; i <= range.stop; i++) { - if (buffer.string[i] == f_string_eos) continue; + if (buffer.string[i] == 0) continue; status = f_utf_character_is_whitespace(buffer.string[i]); @@ -508,7 +508,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == f_false) { for (; i <= j; i++) { - if (buffer.string[i] == f_string_eos) continue; + if (buffer.string[i] == 0) continue; if (fputc(buffer.string[i], output) == 0) { return f_status_set_error(f_error_output); diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index d1bcad0..03d6c50 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -54,7 +54,7 @@ extern "C" { break; } - if (source[i] == f_string_eos) { + if (source[i] == 0) { if (i > 0) { if (i > first) { f_string_length size = i - first; @@ -73,7 +73,7 @@ extern "C" { } } - while (i + 1 < length && source[i + 1] == f_string_eos) { + while (i + 1 < length && source[i + 1] == 0) { i++; } // while @@ -93,11 +93,11 @@ extern "C" { for (; i1 < stop1 && i2 < stop2; i1++, i2++) { // skip past NULL in string1. - while (i1 < stop1 && string1[i1] == f_string_eos) i1++; + while (i1 < stop1 && string1[i1] == 0) i1++; if (i1 == stop1) break; // skip past NULL in string2. - while (i2 < stop2 && string2[i2] == f_string_eos) i2++; + while (i2 < stop2 && string2[i2] == 0) i2++; if (i2 == stop2) break; if (string1[i1] != string2[i2]) return f_not_equal_to; @@ -105,11 +105,11 @@ extern "C" { // only return f_equal_to if all remaining characters are NULL. for (; i1 < stop1; i1++) { - if (string1[i1] != f_string_eos) return f_not_equal_to; + if (string1[i1] != 0) return f_not_equal_to; } // for for (; i2 < stop2; i2++) { - if (string2[i2] != f_string_eos) return f_not_equal_to; + if (string2[i2] != 0) return f_not_equal_to; } // for return f_equal_to; @@ -128,7 +128,7 @@ extern "C" { // skip past leading whitespace in string1. for (; i1 < stop1; i1 += width) { // skip past NULL in string1. - while (i1 < stop1 && string1[i1] == f_string_eos) i1++; + while (i1 < stop1 && string1[i1] == 0) i1++; if (i1 == stop1) break; width_max = (stop1 - i1) + 1; @@ -147,7 +147,7 @@ extern "C" { // skip past leading whitespace in string2. for (; i2 < stop2; i2 += width) { // skip past NULL in string2. - while (i2 < stop2 && string2[i2] == f_string_eos) i2++; + while (i2 < stop2 && string2[i2] == 0) i2++; if (i2 == stop2) break; width_max = (stop2 - i2) + 1; @@ -176,7 +176,7 @@ extern "C" { // determine where the last non-whitespace is in string1. for (f_string_length j = i1; j < stop1; j += width) { // skip past NULL in string1. - while (j < stop1 && string1[j] == f_string_eos) j++; + while (j < stop1 && string1[j] == 0) j++; if (j == stop1) break; width_max = (stop1 - j) + 1; @@ -198,7 +198,7 @@ extern "C" { // determine where the last non-whitespace is in string2. for (f_string_length j = i2; j < stop2; j += width) { // skip past NULL in string2. - while (j < stop2 && string2[j] == f_string_eos) j++; + while (j < stop2 && string2[j] == 0) j++; if (j == stop2) break; width_max = (stop2 - j) + 1; @@ -222,11 +222,11 @@ extern "C" { for (; i1 < last1 && i2 < last2; i1++, i2++) { // skip past NULL in string1. - while (i1 < last1 && string1[i1] == f_string_eos) i1++; + while (i1 < last1 && string1[i1] == 0) i1++; if (i1 == last1) break; // skip past NULL in string2. - while (i2 < last2 && string2[i2] == f_string_eos) i2++; + while (i2 < last2 && string2[i2] == 0) i2++; if (i2 == last2) break; if (string1[i1] != string2[i2]) return f_not_equal_to; @@ -234,12 +234,12 @@ extern "C" { // only return f_equal_to if all remaining characters are NULL. while (i1 < last1) { - if (string1[i1] != f_string_eos) return f_not_equal_to; + if (string1[i1] != 0) return f_not_equal_to; i1++; } // while while (i2 < last2) { - if (string2[i2] != f_string_eos) return f_not_equal_to; + if (string2[i2] != 0) return f_not_equal_to; i2++; } // while @@ -306,7 +306,7 @@ extern "C" { break; } - if (source[i] == f_string_eos) { + if (source[i] == 0) { if (i > 0) { if (i > first) { f_string_length size = i - first; @@ -329,7 +329,7 @@ extern "C" { } } - while (i + 1 < length && source[i + 1] == f_string_eos) { + while (i + 1 < length && source[i + 1] == 0) { i++; } // while @@ -353,7 +353,7 @@ extern "C" { // skip past leading whitespace. for (; *start <= *stop; *start += width) { // skip past NULL. - while (*start < *stop && source[*start] == f_string_eos) (*start)++; + while (*start < *stop && source[*start] == 0) (*start)++; if (*start > *stop) break; status = f_utf_is_whitespace(source + *start, (*stop - *start) + 1); @@ -371,9 +371,9 @@ extern "C" { for (; *stop > *start; (*stop)--) { // skip past NULL. - while (*stop > *start && source[*stop] == f_string_eos) (*stop)--; + while (*stop > *start && source[*stop] == 0) (*stop)--; - if (source[*stop] == f_string_eos) continue; + if (source[*stop] == 0) continue; if (*stop == *start) break; // each UTF-8 character of width 1 is an incomplete part. diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index b1b9a21..6164cb5 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -33,12 +33,12 @@ extern "C" { f_string_length j = 1; while (i <= length && j <= destination->used) { - if (source[length - i] == f_string_eos) { + if (source[length - i] == 0) { i++; continue; } - if (destination->string[destination->used - j] == f_string_eos) { + if (destination->string[destination->used - j] == 0) { j++; continue; } @@ -71,12 +71,12 @@ extern "C" { f_string_length j = 1; while (i <= length && j <= destination->used) { - if (source[length - i] == f_string_eos) { + if (source[length - i] == 0) { i++; continue; } - if (destination->string[destination->used - j] == f_string_eos) { + if (destination->string[destination->used - j] == 0) { j++; continue; } @@ -157,12 +157,12 @@ extern "C" { f_string_length j = 1; while (i <= source.used && j <= destination->used) { - if (source.string[source.used - i] == f_string_eos) { + if (source.string[source.used - i] == 0) { i++; continue; } - if (destination->string[destination->used - j] == f_string_eos) { + if (destination->string[destination->used - j] == 0) { j++; continue; } @@ -195,12 +195,12 @@ extern "C" { f_string_length j = 1; while (i <= source.used && j <= destination->used) { - if (source.string[source.used - i] == f_string_eos) { + if (source.string[source.used - i] == 0) { i++; continue; } - if (destination->string[destination->used - j] == f_string_eos) { + if (destination->string[destination->used - j] == 0) { j++; continue; } @@ -335,12 +335,12 @@ extern "C" { f_string_length j = 1; while (i <= length && j <= destination->used) { - if (source.string[range.stop - i] == f_string_eos) { + if (source.string[range.stop - i] == 0) { i++; continue; } - if (destination->string[destination->used - j] == f_string_eos) { + if (destination->string[destination->used - j] == 0) { j++; continue; } @@ -375,12 +375,12 @@ extern "C" { f_string_length j = 1; while (i <= length && j <= destination->used) { - if (source.string[range.stop - i] == f_string_eos) { + if (source.string[range.stop - i] == 0) { i++; continue; } - if (destination->string[destination->used - j] == f_string_eos) { + if (destination->string[destination->used - j] == 0) { j++; continue; } @@ -531,12 +531,12 @@ extern "C" { f_string_length j = 0; while (i < length && j < destination->used) { - if (source.string[i + range.start] == f_string_eos) { + if (source.string[i + range.start] == 0) { i++; continue; } - if (destination->string[j] == f_string_eos) { + if (destination->string[j] == 0) { j++; continue; } @@ -573,12 +573,12 @@ extern "C" { f_string_length j = 0; while (i < length && j < destination->used) { - if (source.string[i + range.start] == f_string_eos) { + if (source.string[i + range.start] == 0) { i++; continue; } - if (destination->string[j] == f_string_eos) { + if (destination->string[j] == 0) { j++; continue; } @@ -651,12 +651,12 @@ extern "C" { f_string_length j = 0; while (i < source.used && j < destination->used) { - if (source.string[i] == f_string_eos) { + if (source.string[i] == 0) { i++; continue; } - if (destination->string[j] == f_string_eos) { + if (destination->string[j] == 0) { j++; continue; } @@ -689,12 +689,12 @@ extern "C" { f_string_length j = 0; while (i < source.used && j < destination->used) { - if (source.string[i] == f_string_eos) { + if (source.string[i] == 0) { i++; continue; } - if (destination->string[j] == f_string_eos) { + if (destination->string[j] == 0) { j++; continue; } @@ -1042,7 +1042,7 @@ extern "C" { if (destination->used > destination->size) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (destination->used > 0 && destination->string[destination->used - 1] == f_string_eos) return f_none; + if (destination->used > 0 && destination->string[destination->used - 1] == 0) return f_none; if (destination->used + 1 > f_string_max_size) return f_status_set_error(f_string_too_large); @@ -1055,7 +1055,7 @@ extern "C" { if (f_status_is_error(status)) return status; } - destination->string[destination->used] = f_string_eos; + destination->string[destination->used] = 0; destination->used = total; return f_none; @@ -1174,12 +1174,12 @@ extern "C" { f_string_length j = 0; while (i < length && j < destination->used) { - if (source[i] == f_string_eos) { + if (source[i] == 0) { i++; continue; } - if (destination->string[j] == f_string_eos) { + if (destination->string[j] == 0) { j++; continue; } @@ -1212,12 +1212,12 @@ extern "C" { f_string_length j = 0; while (i < length && j < destination->used) { - if (source[i] == f_string_eos) { + if (source[i] == 0) { i++; continue; } - if (destination->string[j] == f_string_eos) { + if (destination->string[j] == 0) { j++; continue; } diff --git a/level_1/fl_utf/c/private-utf.c b/level_1/fl_utf/c/private-utf.c index 5759171..10d167c 100644 --- a/level_1/fl_utf/c/private-utf.c +++ b/level_1/fl_utf/c/private-utf.c @@ -93,11 +93,11 @@ extern "C" { for (; i1 < stop1 && i2 < stop2; i1++, i2++) { // skip past NULL in string1. - while (i1 < stop1 && string1[i1] == f_string_eos) i1++; + while (i1 < stop1 && string1[i1] == 0) i1++; if (i1 == stop1) break; // skip past NULL in string2. - while (i2 < stop2 && string2[i2] == f_string_eos) i2++; + while (i2 < stop2 && string2[i2] == 0) i2++; if (i2 == stop2) break; if (string1[i1] != string2[i2]) return f_not_equal_to; @@ -105,11 +105,11 @@ extern "C" { // only return f_equal_to if all remaining characters are NULL. for (; i1 < stop1; i1++) { - if (string1[i1] != f_string_eos) return f_not_equal_to; + if (string1[i1] != 0) return f_not_equal_to; } // for for (; i2 < stop2; i2++) { - if (string2[i2] != f_string_eos) return f_not_equal_to; + if (string2[i2] != 0) return f_not_equal_to; } // for return f_equal_to; @@ -126,7 +126,7 @@ extern "C" { // skip past leading whitespace in string1. for (; i1 < stop1; i1++) { // skip past NULL in string1. - while (i1 < stop1 && string1[i1] == f_string_eos) i1++; + while (i1 < stop1 && string1[i1] == 0) i1++; if (i1 == stop1) break; status = f_utf_character_is_whitespace(string1[i1]); @@ -143,7 +143,7 @@ extern "C" { // skip past leading whitespace in string2. for (; i2 < stop2; i2++) { // skip past NULL in string2. - while (i2 < stop2 && string2[i2] == f_string_eos) i2++; + while (i2 < stop2 && string2[i2] == 0) i2++; if (i2 == stop2) break; status = f_utf_character_is_whitespace(string2[i2]); @@ -168,7 +168,7 @@ extern "C" { // determine where the last non-whitespace is in string1. for (f_utf_string_length j = i1; j < stop1; j++) { // skip past NULL in string1. - while (j < stop1 && string1[j] == f_string_eos) j++; + while (j < stop1 && string1[j] == 0) j++; if (j == stop1) break; status = f_utf_character_is_whitespace(string1[j]); @@ -188,7 +188,7 @@ extern "C" { // determine where the last non-whitespace is in string2. for (f_utf_string_length j = i2; j < stop2; j++) { // skip past NULL in string2. - while (j < stop2 && string2[j] == f_string_eos) j++; + while (j < stop2 && string2[j] == 0) j++; if (j == stop2) break; status = f_utf_character_is_whitespace(string2[j]); @@ -210,11 +210,11 @@ extern "C" { for (; i1 < last1 && i2 < last2; i1++, i2++) { // skip past NULL in string1. - while (i1 < last1 && string1[i1] == f_string_eos) i1++; + while (i1 < last1 && string1[i1] == 0) i1++; if (i1 == last1) break; // skip past NULL in string2. - while (i2 < last2 && string2[i2] == f_string_eos) i2++; + while (i2 < last2 && string2[i2] == 0) i2++; if (i2 == last2) break; if (string1[i1] != string2[i2]) return f_not_equal_to; @@ -222,11 +222,11 @@ extern "C" { // only return f_equal_to if all remaining characters are NULL. for (; i1 < last1; i1++) { - if (string1[i1] != f_string_eos) return f_not_equal_to; + if (string1[i1] != 0) return f_not_equal_to; } // for for (; i2 < last2; i2++) { - if (string2[i2] != f_string_eos) return f_not_equal_to; + if (string2[i2] != 0) return f_not_equal_to; } // for return f_equal_to; @@ -337,7 +337,7 @@ extern "C" { // skip past leading whitespace. for (; *start <= *stop; (*start)++) { // skip past NULL. - while (*start < *stop && source[*start] == f_string_eos) (*start)++; + while (*start < *stop && source[*start] == 0) (*start)++; if (*start > *stop) break; status = f_utf_character_is_whitespace(source[*start]); @@ -353,9 +353,9 @@ extern "C" { for (; *stop > *start; (*stop)--) { // skip past NULL. - while (*stop > *start && source[*stop] == f_string_eos) (*stop)--; + while (*stop > *start && source[*stop] == 0) (*stop)--; - if (source[*stop] == f_string_eos) continue; + if (source[*stop] == 0) continue; if (*stop == *start) break; status = f_utf_character_is_whitespace(source[*stop]); diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index 609037e..ef93975 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -223,7 +223,7 @@ extern "C" { } if (name_size == 0) { - fixed_arguments[0] = f_string_eos; + fixed_arguments[0] = 0; } else { fixed_arguments[0] = program_name; @@ -243,7 +243,7 @@ extern "C" { } memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used); - fixed_arguments[i + 1][arguments.array[i].used] = f_string_eos; + fixed_arguments[i + 1][arguments.array[i].used] = 0; } // for // insert the required array terminated @@ -328,7 +328,7 @@ extern "C" { } if (name_size == 0) { - fixed_arguments[0] = f_string_eos; + fixed_arguments[0] = 0; } else { fixed_arguments[0] = program_name; @@ -348,7 +348,7 @@ extern "C" { } memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used); - fixed_arguments[i + 1][arguments.array[i].used] = f_string_eos; + fixed_arguments[i + 1][arguments.array[i].used] = 0; } // for // insert the required array terminated @@ -425,7 +425,7 @@ extern "C" { } memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used); - fixed_arguments[i + 1][arguments.array[i].used] = f_string_eos; + fixed_arguments[i + 1][arguments.array[i].used] = 0; } // for // insert the required array terminated @@ -495,7 +495,7 @@ extern "C" { } memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used); - fixed_arguments[i + 1][arguments.array[i].used] = f_string_eos; + fixed_arguments[i + 1][arguments.array[i].used] = 0; } // for // insert the required array terminated diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index dc27d64..2f9af8b 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -447,7 +447,7 @@ extern "C" { f_string_length total = 1; for (f_string_length j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { - if (data->buffer.string[j] == f_string_eos) continue; + if (data->buffer.string[j] == 0) continue; if (data->buffer.string[j] == f_string_eol) { total++; @@ -471,7 +471,7 @@ extern "C" { if (line == 0) { for (; i <= data->contents.array[i].array[0].stop; i++) { - if (data->buffer.string[i] == f_string_eos) continue; + if (data->buffer.string[i] == 0) continue; if (data->buffer.string[i] == f_string_eol) { fprintf(f_standard_output, "%c", f_string_eol); break; @@ -484,7 +484,7 @@ extern "C" { f_string_length line_current = 0; for (; i <= data->contents.array[i].array[0].stop; i++) { - if (data->buffer.string[i] == f_string_eos) continue; + if (data->buffer.string[i] == 0) continue; if (data->buffer.string[i] == f_string_eol) { line_current++; @@ -493,7 +493,7 @@ extern "C" { i++; for (; i <= data->contents.array[i].array[0].stop; i++) { - if (data->buffer.string[i] == f_string_eos) continue; + if (data->buffer.string[i] == 0) continue; if (data->buffer.string[i] == f_string_eol) { fprintf(f_standard_output, "%c", f_string_eol); break; @@ -544,7 +544,7 @@ extern "C" { } for (f_string_length j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { - if (data->buffer.string[j] == f_string_eos) continue; + if (data->buffer.string[j] == 0) continue; if (data->buffer.string[j] == f_string_eol) { total++; @@ -598,7 +598,7 @@ extern "C" { if (j > data->contents.array[i].array[0].stop) continue; for (; j <= data->contents.array[i].array[0].stop; j++) { - if (data->buffer.string[j] == f_string_eos) continue; + if (data->buffer.string[j] == 0) continue; if (data->buffer.string[j] == f_string_eol) { fprintf(f_standard_output, "%c", f_string_eol); diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index 17ca9d6..bc50bcd 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -460,7 +460,7 @@ extern "C" { f_string_length total = 1; for (f_string_length j = items->array[i].content.array[0].start; j <= items->array[i].content.array[0].stop; j++) { - if (data->buffer.string[j] == f_string_eos) continue; + if (data->buffer.string[j] == 0) continue; if (data->buffer.string[j] == f_string_eol) { total++; @@ -484,7 +484,7 @@ extern "C" { if (line == 0) { for (; i <= items->array[i].content.array[0].stop; i++) { - if (data->buffer.string[i] == f_string_eos) continue; + if (data->buffer.string[i] == 0) continue; if (data->buffer.string[i] == f_string_eol) { fprintf(f_standard_output, "%c", f_string_eol); break; @@ -497,7 +497,7 @@ extern "C" { f_string_length line_current = 0; for (; i <= items->array[i].content.array[0].stop; i++) { - if (data->buffer.string[i] == f_string_eos) continue; + if (data->buffer.string[i] == 0) continue; if (data->buffer.string[i] == f_string_eol) { line_current++; @@ -506,7 +506,7 @@ extern "C" { i++; for (; i <= items->array[i].content.array[0].stop; i++) { - if (data->buffer.string[i] == f_string_eos) continue; + if (data->buffer.string[i] == 0) continue; if (data->buffer.string[i] == f_string_eol) { fprintf(f_standard_output, "%c", f_string_eol); break; @@ -557,7 +557,7 @@ extern "C" { } for (f_string_length j = items->array[i].content.array[0].start; j <= items->array[i].content.array[0].stop; j++) { - if (data->buffer.string[j] == f_string_eos) continue; + if (data->buffer.string[j] == 0) continue; if (data->buffer.string[j] == f_string_eol) { total++; @@ -611,7 +611,7 @@ extern "C" { if (j > items->array[i].content.array[0].stop) continue; for (; j <= items->array[i].content.array[0].stop; j++) { - if (data->buffer.string[j] == f_string_eos) continue; + if (data->buffer.string[j] == 0) continue; if (data->buffer.string[j] == f_string_eol) { fprintf(f_standard_output, "%c", f_string_eol); -- 1.8.3.1