Commits

Shlomi Fish  committed c8956d2

Simplified the strings_starts_with function call.

git-svn-id: file:///home/shlomif/Backup/svn-dumps/google-code/svnsync-repos/fc-solve/trunk@2867 e7e8a897-7ba4-4ee7-b36f-f4c66519b19a

  • Participants
  • Parent commits 8ccd272

Comments (0)

Files changed (1)

File fc-solve/source/lib.c

 static int string_starts_with(
     const char * str,
     const char * prefix,
-    int check_len
+    const char * end
     )
 {
+    register int check_len = end-str;
+
     return
         (
          (check_len == strlen(prefix)) 
                     return FCS_COMPILE_FLARES_RET_COLON_NOT_FOUND;
                 }
 
-                if (string_starts_with(item_start, "Run", cmd_end-item_start))
+                if (string_starts_with(item_start, "Run", cmd_end))
                 {
                     char * at_sign, * after_at_sign;
                     int count_iters;
                     /* TODO : free plan upon an error. */
                     last_item_type = add_count_iters_to_plan(instance_item, flare_idx, count_iters);
                 }
-                else if (string_starts_with(item_start, "CP", cmd_end-item_start))
+                else if (string_starts_with(item_start, "CP", cmd_end))
                 {
                     item_end = cmd_end+1;
                     if (! (((*item_end) == ',') || (! (*item_end))))
                     /* TODO : free plan upon an error. */
                     last_item_type = add_checkpoint_to_plan(instance_item);
                 }
-                else if (string_starts_with(item_start, "RunIndef", cmd_end-item_start))
+                else if (string_starts_with(item_start, "RunIndef", cmd_end))
                 {
                     int found_flare;
                     int flare_idx;