diff options
author | Marc G. Fournier <scrappy@hub.org> | 1996-09-16 06:06:17 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1996-09-16 06:06:17 +0000 |
commit | f589ca68001c82d3e15e86f8e6ff33ad344f7062 (patch) | |
tree | 5fbbb100320166d48a8d6549fe0c109f82e4b7ed /src/bin/psql/stringutils.c | |
parent | 24f001226865d914c6e388ea0f1edb468098bb9d (diff) | |
download | postgresql-f589ca68001c82d3e15e86f8e6ff33ad344f7062.tar.gz postgresql-f589ca68001c82d3e15e86f8e6ff33ad344f7062.zip |
The following diffs remove the various definitions of dupstr() and replace
all the calls with strdup.
Submitted by: darcy@druid.druid.com (D'Arcy J.M. Cain)
Diffstat (limited to 'src/bin/psql/stringutils.c')
-rw-r--r-- | src/bin/psql/stringutils.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/bin/psql/stringutils.c b/src/bin/psql/stringutils.c index daeb120ef9a..42902e64384 100644 --- a/src/bin/psql/stringutils.c +++ b/src/bin/psql/stringutils.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.3 1996/08/06 20:23:14 julian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.4 1996/09/16 06:06:17 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -57,22 +57,6 @@ char *doubleTrim(char *s) return s; } -/* dupstr : copies a string, while allocating space for it. - the CALLER is responsible for freeing the space - returns NULL if the argument is NULL */ -char *dupstr(char *s) -{ - char *result; - - if (s == NULL) - return NULL; - - result = (char*)malloc(strlen(s)+1); - strcpy(result, s); - return result; -} - - #ifdef STRINGUTILS_TEST void testStringUtils() { @@ -87,13 +71,13 @@ void testStringUtils() while (tests[i]!=NULL_STR) { char *t; - t = dupstr(tests[i]); + t = strdup(tests[i]); printf("leftTrim(%s) = ",t); printf("%sEND\n", leftTrim(t)); - t = dupstr(tests[i]); + t = strdup(tests[i]); printf("rightTrim(%s) = ",t); printf("%sEND\n", rightTrim(t)); - t = dupstr(tests[i]); + t = strdup(tests[i]); printf("doubleTrim(%s) = ",t); printf("%sEND\n", doubleTrim(t)); i++; |