]> Kevux Git Server - fll/commitdiff
Update: initialize string locations to {1, 0}
authorKevin Day <kevin@kevux.org>
Thu, 1 Mar 2012 04:51:38 +0000 (22:51 -0600)
committerKevin Day <kevin@kevux.org>
Thu, 1 Mar 2012 04:58:50 +0000 (22:58 -0600)
This is done so that the start position is always after the stop position.
In such a case, this means that the range is undefined.
Originally. -1 was used, but that does not work if the position integers are unsigned.
Using {1, 0} allows for assigning an undefined state with unsigned integers.

Also note that the default of {0, 0} means start at 0 and stop at 0, which would return the value at position 0 and no other values after that first value.

level_0/f_strings/c/strings.h
level_3/fss_basic_list_read/c/fss_basic_list_read.c
level_3/fss_basic_read/c/fss_basic_read.c
level_3/fss_extended_read/c/fss_extended_read.c

index 15e12778e116a96236e2646844cc3fb9a28d1602..49d0c5023d4d4a782730cba621042604f9c55b96 100644 (file)
@@ -124,7 +124,7 @@ extern "C"{
     f_string_length stop;
   } f_string_location;
 
-  #define f_string_location_initialize { f_string_length_initialize, f_string_length_initialize }
+  #define f_string_location_initialize { 1, 0 }
 
   #define f_new_string_location(status, string_location, length)   status = f_new_array((void **) & string_location, sizeof(f_string_location), length)
   #define f_delete_string_location(status, string_location, size)  status = f_delete((void **) & string_location, sizeof(f_string_location), size)
index e7dafe44ad9886b3200021c6a5a1c9d6a26c61ab..6cf69b8914dc22c21e08452a72f10c9208cae0b3 100644 (file)
@@ -249,7 +249,8 @@ extern "C"{
         {
           f_string_location input = f_string_location_initialize;
 
-          input.stop = data->buffer.used - 1;
+          input.start = 0;
+          input.stop  = data->buffer.used - 1;
 
           status = fll_fss_basic_list_read(&data->buffer, &input, &data->objects, &data->contents);
         }
index 2b36c73038a8f62d68b3e301e87de4afb5e6f017..eab61058352d938ecb2985061be90cbd75d7f8b2 100644 (file)
@@ -235,7 +235,8 @@ extern "C"{
         {
           f_string_location input = f_string_location_initialize;
 
-          input.stop = data->buffer.used - 1;
+          input.start = 0;
+          input.stop  = data->buffer.used - 1;
 
           status = fll_fss_basic_read(&data->buffer, &input, &data->objects, &data->contents);
         }
index 611ca23bdb48f5fedaa0838b152d9034837ceaf0..76eef8433445bf150d92c88a1d7baf7c2f1aa9f0 100644 (file)
@@ -247,7 +247,8 @@ extern "C"{
         {
           f_string_location input = f_string_location_initialize;
 
-          input.stop = data->buffer.used - 1;
+          input.start = 0;
+          input.stop  = data->buffer.used - 1;
 
           status = fll_fss_extended_read(&data->buffer, &input, &data->objects, &data->contents);
         }