From: Kevin Day Date: Sat, 2 Nov 2019 20:05:07 +0000 (-0500) Subject: Progress: use the content_nests equivalents in place of the contents X-Git-Tag: 0.5.0~403 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=8e66c050a295352810b0a21c700e3573c6efc689;p=fll Progress: use the content_nests equivalents in place of the contents When I copied basic_list code to use a starting point for extended, I missed creating "nest" equivalents to some code. --- diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index 04fec73..adeb5d8 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -203,7 +203,7 @@ extern "C" { fl_macro_fss_skip_past_delimit_placeholders((*buffer), (*location)) fl_macro_fss_content_nest_return_on_overflow((*buffer), (*location), (*found), positions_start, delimits, f_none_on_eos, f_none_on_stop) - fl_macro_fss_allocate_content_if_necessary((*found), delimits); + fl_macro_fss_allocate_content_nest_if_necessary((*found), delimits); f_array_length depth = 0; f_string_length position_previous = location->start; diff --git a/level_1/fl_fss/c/fss_macro.h b/level_1/fl_fss/c/fss_macro.h index ee93058..8574123 100644 --- a/level_1/fl_fss/c/fss_macro.h +++ b/level_1/fl_fss/c/fss_macro.h @@ -137,6 +137,21 @@ extern "C" { } #endif // _di_fl_macro_fss_content_delimited_return_on_overflow_ +#ifndef _di_fl_macro_fss_allocate_content_if_necessary_ + #define fl_macro_fss_allocate_content_if_necessary(content, delimits) \ + if (content.used >= content.size) { \ + f_status status = f_none; \ + \ + f_macro_fss_content_resize(status, content, content.size + f_fss_default_allocation_step); \ + if (f_status_is_error(status)) { \ + f_status macro_allocation_status = f_none; \ + f_macro_string_lengths_delete(macro_allocation_status, delimits); \ + \ + return status; \ + } \ + } +#endif // _di_fl_macro_fss_allocate_content_if_necessary_ + #ifndef _di_fl_macro_fss_content_nest_return_on_overflow_ #define fl_macro_fss_content_nest_return_on_overflow(buffer, location, found, delimits, positions, eos_status, stop_status) \ if (location.start >= buffer.used) { \ @@ -188,12 +203,12 @@ extern "C" { // @todo: found.array[found.used].stop = location.stop; #endif // _di_fl_macro_fss_content_nest_delimited_return_on_overflow_ -#ifndef _di_fl_macro_fss_allocate_content_if_necessary_ - #define fl_macro_fss_allocate_content_if_necessary(content, delimits) \ +#ifndef _di_fl_macro_fss_allocate_content_nest_if_necessary_ + #define fl_macro_fss_allocate_content_nest_if_necessary(content, delimits) \ if (content.used >= content.size) { \ f_status status = f_none; \ \ - f_macro_fss_content_resize(status, content, content.size + f_fss_default_allocation_step); \ + f_macro_fss_content_nest_resize(status, content, content.size + f_fss_default_allocation_step); \ if (f_status_is_error(status)) { \ f_status macro_allocation_status = f_none; \ f_macro_string_lengths_delete(macro_allocation_status, delimits); \ @@ -201,7 +216,7 @@ extern "C" { return status; \ } \ } -#endif // _di_fl_macro_fss_allocate_content_if_necessary_ +#endif // _di_fl_macro_fss_allocate_content_nest_if_necessary_ #ifndef _di_fl_macro_fss_object_seek_till_newline_ #define fl_macro_fss_object_seek_till_newline(buffer, location, delimits, eos_status, stop_status) \ diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index e669fa1..62f29a3 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -192,7 +192,7 @@ extern "C" { } // clear buffers before repeating the loop - f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_content_nests_delete(status2, data->contents); f_macro_fss_objects_delete(status2, data->objects); f_macro_string_dynamic_delete(status2, data->buffer); } // for @@ -217,7 +217,7 @@ extern "C" { i++; } // while - f_macro_fss_contents_delete(status, data->contents); + f_macro_fss_content_nests_delete(status, data->contents); f_macro_fss_objects_delete(status, data->objects); f_macro_string_dynamic_delete(status, data->buffer); f_macro_string_lengths_delete(status, data->remaining);