From: Kevin Day Date: Fri, 30 Mar 2012 02:23:50 +0000 (-0500) Subject: Cleanup: only define location variable when needed X-Git-Tag: 0.3.0~45 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=b6a4d11c9a1f927739a1b130dfee89d9dc61f640;p=fll Cleanup: only define location variable when needed Instead of defining it outside the loop, define it inside the loop and then only in the areas where it is needed. --- diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index 8359e15..ac4a5b3 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -33,8 +33,7 @@ extern "C"{ // when handling delimits, the only time they should be applied is when a valid object would exist // however, the delimits will appear before a valid object, so remember their positions and only apply them after a would be valid object is confirmed - f_bool has_delimit = f_false; - f_string_length location = f_string_length_initialize; + f_bool has_delimit = f_false; // begin the search found->start = input->start; @@ -123,7 +122,8 @@ extern "C"{ fl_macro_fss_object_return_on_overflow((*buffer), (*input), (*found), f_unterminated_group_on_eos, f_unterminated_group_on_stop) if (buffer->string[input->start] == quoted) { - location = input->start; + f_string_length location = input->start; + input->start = first_slash; if (slash_count % 2 == 0) { diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index ea05a8f..502f202 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -33,8 +33,7 @@ extern "C"{ // when handling delimits, the only time they should be applied is when a valid object would exist // however, the delimits will appear before a valid object, so remember their positions and only apply them after a would be valid object is confirmed - f_bool has_delimit = f_false; - f_string_length location = f_string_length_initialize; + f_bool has_delimit = f_false; // begin the search found->start = input->start; @@ -123,7 +122,8 @@ extern "C"{ fl_macro_fss_object_return_on_overflow((*buffer), (*input), (*found), f_unterminated_group_on_eos, f_unterminated_group_on_stop) if (buffer->string[input->start] == quoted) { - location = input->start; + f_string_length location = input->start; + input->start = first_slash; if (slash_count % 2 == 0) {