]> granicus.if.org Git - yasm/commitdiff
* cleanup.c: Add strdup implementation as strdup is nonstandard C.
authorPeter Johnson <peter@tortall.net>
Sun, 9 Oct 2005 06:10:03 +0000 (06:10 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 9 Oct 2005 06:10:03 +0000 (06:10 -0000)
svn path=/trunk/yasm/; revision=1272

tools/re2c/cleanup.c

index bf5e1b053592e588c39313f540629fa80ef2c98f..6c0ba77d003cf7159eb5f16a0ecbffe3fa756b58 100644 (file)
 
 #define MAXLINE        1024
 
+static char *
+mystrdup(const char *str)
+{
+       size_t len;
+       char *copy;
+
+       len = strlen(str) + 1;
+       copy = malloc(len);
+       memcpy(copy, str, len);
+       return (copy);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -77,7 +89,7 @@ main(int argc, char *argv[])
                return EXIT_FAILURE;
            }
        }
-       inlines[numlines] = strdup(str);
+       inlines[numlines] = mystrdup(str);
        numlines++;
     }