]> Kevux Git Server - fll/commitdiff
Bugfix: initial slash + quote only needs one additional slash on match at start when...
authorKevin Day <kevin@kevux.org>
Thu, 22 Mar 2012 00:43:44 +0000 (19:43 -0500)
committerKevin Day <kevin@kevux.org>
Thu, 22 Mar 2012 00:43:44 +0000 (19:43 -0500)
If the object or content group begins with any number of slashes followed by a single or double quite, only a single slash is needed to delimit the quote.
This is done because no valid object or content group can start with a slash and expected to be treated as if it were quoted.
That means the quote is meaningless.
The initial slash delimit is necessary in case the object name starts with a single or double quote but it should not be treated as such.
This for an object name of " would be written as \".

level_1/fl_fss/c/fss_basic.c
level_1/fl_fss/c/fss_extended.c

index 05b11c14fcbd291c93b328ed758cac144cbd0312..d9acabfb295397463629cad05a33eb1f0cc8fc26 100644 (file)
@@ -300,8 +300,6 @@ extern "C"{
     object_position.stop  = object->used;
 
     if (buffer.string[input->start] == f_fss_delimit_slash) {
-      f_string_length slash_count = 0;
-
       while (input->start <= input->stop && input->start < buffer.used) {
         if (buffer.string[input->start] == f_fss_delimit_placeholder) {
           input->start++;
@@ -312,12 +310,11 @@ extern "C"{
 
         object->string[object_position.stop] = buffer.string[input->start];
         object_position.stop++;
-        slash_count++;
         input->start++;
       } // while
 
       if (buffer.string[input->start] == f_fss_delimit_single_quote || buffer.string[input->start] == f_fss_delimit_double_quote) {
-        pre_allocate_size += slash_count + 1;
+        pre_allocate_size++;
 
         if (pre_allocate_size > object->size) {
           f_resize_dynamic_string(status, (*object), pre_allocate_size + f_fss_default_allocation_step);
@@ -325,14 +322,9 @@ extern "C"{
           if (f_macro_test_for_allocation_errors(status)) return status;
         }
 
-        while (slash_count > 0) {
-          object->string[object_position.stop] = f_fss_delimit_slash;
-          object_position.stop++;
-          slash_count--;
-        } // while
-
-        object->string[object_position.stop] = buffer.string[input->start];
-        object_position.stop++;
+        object->string[object_position.stop] = f_fss_delimit_slash;
+        object->string[object_position.stop + 1] = buffer.string[input->start];
+        object_position.stop += 2;
         input->start++;
       }
     } else if (buffer.string[input->start] == f_fss_delimit_single_quote || buffer.string[input->start] == f_fss_delimit_double_quote) {
index 7bd68b30963ea39a9a8f6af0b7604b372886aae2..a2ed20262b25b6962b04c4d85ab008a3ae833a60 100644 (file)
@@ -432,8 +432,6 @@ extern "C"{
     object_position.stop  = object->used;
 
     if (buffer.string[input->start] == f_fss_delimit_slash) {
-      f_string_length slash_count = 0;
-
       while (input->start <= input->stop && input->start < buffer.used) {
         if (buffer.string[input->start] == f_fss_delimit_placeholder) {
           input->start++;
@@ -444,12 +442,11 @@ extern "C"{
 
         object->string[object_position.stop] = buffer.string[input->start];
         object_position.stop++;
-        slash_count++;
         input->start++;
       } // while
 
       if (buffer.string[input->start] == f_fss_delimit_single_quote || buffer.string[input->start] == f_fss_delimit_double_quote) {
-        pre_allocate_size += slash_count + 1;
+        pre_allocate_size++;
 
         if (pre_allocate_size > object->size) {
           f_resize_dynamic_string(status, (*object), pre_allocate_size + f_fss_default_allocation_step);
@@ -457,14 +454,9 @@ extern "C"{
           if (f_macro_test_for_allocation_errors(status)) return status;
         }
 
-        while (slash_count > 0) {
-          object->string[object_position.stop] = f_fss_delimit_slash;
-          object_position.stop++;
-          slash_count--;
-        } // while
-
-        object->string[object_position.stop] = buffer.string[input->start];
-        object_position.stop++;
+        object->string[object_position.stop] = f_fss_delimit_slash;
+        object->string[object_position.stop + 1] = buffer.string[input->start];
+        object_position.stop += 2;
         input->start++;
       }
     } else if (buffer.string[input->start] == f_fss_delimit_single_quote || buffer.string[input->start] == f_fss_delimit_double_quote) {
@@ -631,8 +623,6 @@ extern "C"{
 
     // if this first slash is followed by a quote, then that quote must be delimited.
     if (buffer.string[input->start] == f_fss_delimit_slash) {
-      f_string_length slash_count = 1;
-
       content->string[content_position.stop] = f_fss_delimit_slash;
       content_position.stop++;
       input->start++;
@@ -649,7 +639,6 @@ extern "C"{
 
         content->string[content_position.stop] = f_fss_delimit_slash;
         content_position.stop++;
-        slash_count++;
         input->start++;
       } // while
 
@@ -664,7 +653,7 @@ extern "C"{
       }
 
       if (buffer.string[input->start] == f_fss_delimit_single_quote || buffer.string[input->start] == f_fss_delimit_double_quote) {
-        pre_allocate_size += slash_count + 1;
+        pre_allocate_size++;
 
         if (pre_allocate_size > content->size) {
           f_resize_dynamic_string(status, (*content), pre_allocate_size + f_fss_default_allocation_step);
@@ -672,14 +661,9 @@ extern "C"{
           if (f_macro_test_for_allocation_errors(status)) return status;
         }
 
-        while (slash_count > 0) {
-          content->string[content_position.stop] = f_fss_delimit_slash;
-          content_position.stop++;
-          slash_count--;
-        } // while
-
-        content->string[content_position.stop] = buffer.string[input->start];
-        content_position.stop++;
+        content->string[content_position.stop] = f_fss_delimit_slash;
+        content->string[content_position.stop + 1] = buffer.string[input->start];
+        content_position.stop += 2;
         input->start++;
       }
     } else if (buffer.string[input->start] == f_fss_delimit_single_quote || buffer.string[input->start] == f_fss_delimit_double_quote) {