From bd45ec37cef6779c2e31747562495e3c73c94410 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 9 Oct 2005 06:10:03 +0000 Subject: [PATCH] * cleanup.c: Add strdup implementation as strdup is nonstandard C. svn path=/trunk/yasm/; revision=1272 --- tools/re2c/cleanup.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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++; } -- 2.40.0