From: Peter Johnson Date: Sun, 9 Oct 2005 06:10:03 +0000 (-0000) Subject: * cleanup.c: Add strdup implementation as strdup is nonstandard C. X-Git-Tag: v0.5.0rc1~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd45ec37cef6779c2e31747562495e3c73c94410;p=yasm * cleanup.c: Add strdup implementation as strdup is nonstandard C. svn path=/trunk/yasm/; revision=1272 --- diff --git a/tools/re2c/cleanup.c b/tools/re2c/cleanup.c index bf5e1b05..6c0ba77d 100644 --- a/tools/re2c/cleanup.c +++ b/tools/re2c/cleanup.c @@ -31,6 +31,18 @@ #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++; }