diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-03-31 08:14:31 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-03-31 08:14:31 +0000 |
commit | e718655433a4c7cd86bff24f52df6e7ba6b22b74 (patch) | |
tree | 5b2007b551e6db11faf1c5a68566a2cfc580c270 | |
parent | 0b83e04ba6fdd33c55a64fd0a729ec009a1a8308 (diff) |
GRDOC and bugfix for CCTK_Strdup.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1507 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | src/util/Misc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/util/Misc.c b/src/util/Misc.c index b69e8e47..0622eb0e 100644 --- a/src/util/Misc.c +++ b/src/util/Misc.c @@ -102,12 +102,27 @@ int Util_SplitString(char **before, char **after, const char *string, const char return retval; } + /*@@ + @routine CCTK_Strdup + @date Thu Mar 28 11:20:27 2000 + @author Gerd Lanfermann + @desc + CCTK version of strdup, since it's not guaranteed to be there. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ char *CCTK_Strdup(const char *s) { char *retstr; - retstr = (char*) malloc(strlen(s)*sizeof(char)); + retstr = (char*) malloc((strlen(s)+1)*sizeof(char)); sprintf(retstr,"%s",s); + return(retstr); } |