]> 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 15e1277..49d0c50 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 e7dafe4..6cf69b8 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 2b36c73..eab6105 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 611ca23..76eef84 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);
         }