diff options
author | scuri <scuri> | 2009-06-23 20:55:28 +0000 |
---|---|---|
committer | scuri <scuri> | 2009-06-23 20:55:28 +0000 |
commit | f658209d25477c490bf1892e68a0fd1384c1dded (patch) | |
tree | 1d4a2a1088db5ad62acaa3f97f13ccc8906c33b1 /src/cd_util.c | |
parent | 0610dd4f3064220a2e8fb1d8dc120044eb6c64a8 (diff) |
*** empty log message ***
Diffstat (limited to 'src/cd_util.c')
-rw-r--r-- | src/cd_util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cd_util.c b/src/cd_util.c index dadb6f4..1767ac4 100644 --- a/src/cd_util.c +++ b/src/cd_util.c @@ -333,3 +333,19 @@ char* cdStrDup(const char *str) } return NULL; } + +char* cdStrDupN(const char *str, int len) +{ + if (str) + { + int size = len+1; + char *newstr = malloc(size); + if (newstr) + { + memcpy(newstr, str, len); + newstr[len]=0; + } + return newstr; + } + return NULL; +} |