diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-10-14 19:10:45 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-10-14 19:10:45 +0000 |
commit | 8f71bf1d543bc7f8060e71577454e7cf1283fe57 (patch) | |
tree | b6cfbdffaad259ea4ff8c43d7e1e9abb33446d1f /libiberty/argv.c | |
parent | f65e414240ee016cf507291d503077291abd3616 (diff) | |
download | gcc-8f71bf1d543bc7f8060e71577454e7cf1283fe57.tar.gz |
Tue Oct 14 12:01:00 1997 Mark Mitchell <mmitchell@usa.net>
* cplus-dem.c (demangle_signature): Don't look for return types on
constructors. Handle member template constructors.
and update from devo.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@15901 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/argv.c')
-rw-r--r-- | libiberty/argv.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/libiberty/argv.c b/libiberty/argv.c index 60694f919bb..824a0298836 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -72,6 +72,63 @@ extern char *strdup (); /* Duplicate a string */ NAME + dupargv -- duplicate an argument vector + +SYNOPSIS + + char **dupargv (vector) + char **vector; + +DESCRIPTION + + Duplicate an argument vector. Simply scans through the + vector, duplicating each argument argument until the + terminating NULL is found. + +RETURNS + + Returns a pointer to the argument vector if + successful. Returns NULL if there is insufficient memory to + complete building the argument vector. + +*/ + +char ** +dupargv (argv) + char **argv; +{ + int argc; + char **copy; + + if (argv == NULL) + return NULL; + + /* the vector */ + for (argc = 0; argv[argc] != NULL; argc++); + copy = (char **) malloc ((argc + 1) * sizeof (char *)); + if (copy == NULL) + return NULL; + + /* the strings */ + for (argc = 0; argv[argc] != NULL; argc++) + { + int len = strlen (argv[argc]); + copy[argc] = malloc (sizeof (char *) * (len + 1)); + if (copy[argc] == NULL) + { + freeargv (copy); + return NULL; + } + strcpy (copy[argc], argv[argc]); + } + copy[argc] = NULL; + return copy; +} + +/* + +NAME + freeargv -- free an argument vector SYNOPSIS |