added
[fw/sdcc] / src / SDCCmain.c
index ac9385656809bc1652edb44083c02b23afe3bf5f..8e9f367ffaae8c2ecbe8e201d278cc86200ab663 100644 (file)
@@ -524,22 +524,35 @@ printUsage (void)
 /* setParseWithComma - separates string with comma to a set        */
 /*-----------------------------------------------------------------*/
 void
-setParseWithComma (set **dest, char *src)
+setParseWithComma (set **dest, const char *src)
 {
-  char *p;
-  int length;
+  const char *p, *end;
+  struct dbuf_s dbuf;
 
   /* skip the initial white spaces */
   while (isspace((unsigned char)*src))
-    src++;
+    ++src;
 
   /* skip the trailing white spaces */
-  length = strlen(src);
-  while (length && isspace((unsigned char)src[length-1]))
-    src[--length] = '\0';
+  end = &src[strlen(src) - 1];
+  while (end >= src && isspace((unsigned char)*end))
+    --end;
+  ++end;
+
+  dbuf_init(&dbuf, 16);
+
+  p = src;
+  while (src < end)
+    {
+      while (p < end && ',' != *p)
+        ++p;
+      dbuf_append(&dbuf, src, p - src);
+      addSet(dest, Safe_strdup(dbuf_c_str(&dbuf)));
+      dbuf_set_size(&dbuf, 0);
+      src = ++p;
+    }
 
-  for (p = strtok(src, ","); p != NULL; p = strtok(NULL, ","))
-    addSet(dest, Safe_strdup(p));
+  dbuf_destroy(&dbuf);
 }
 
 /*-----------------------------------------------------------------*/
@@ -554,7 +567,7 @@ setDefaultOptions (void)
   options.code_loc = 0;           /* code starts at 0 */
   options.data_loc = 0;           /* JCF: By default let the linker locate data */
   options.xdata_loc = 0;
-  options.idata_loc = 0x80;
+  options.idata_loc = 0;          /* MB: No need to limit idata to 0x80-0xFF */
   options.nopeep = 0;
   options.model = port->general.default_model;
   options.nostdlib = 0;
@@ -666,7 +679,7 @@ processFile (char *s)
     }
 
   /* if the extention is type .rel or .r or .REL or .R
-     addtional object file will be passed to the linker */
+     additional object file will be passed to the linker */
   if (strcmp (fext, ".r") == 0 || strcmp (fext, ".rel") == 0 ||
       strcmp (fext, ".R") == 0 || strcmp (fext, ".REL") == 0 ||
       strcmp (fext, port->linker.rel_ext) == 0)