diff options
Diffstat (limited to 'src/common/string.c')
-rw-r--r-- | src/common/string.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/string.c b/src/common/string.c index 9dce27b..2c73900 100644 --- a/src/common/string.c +++ b/src/common/string.c @@ -1,4 +1,5 @@ #include <string.h> +#include <malloc.h> size_t strlen(const char* str) { @@ -87,4 +88,14 @@ void *memset(void *dest, int val, size_t count) { return dest; } +char *strdup(const char* str) { + int len = strlen(str) + 1; + + char* ret = (char*)malloc(len); + if (ret == 0) return 0; + + memcpy(ret, str, len); + return ret; +} + /* vim: set ts=4 sw=4 tw=0 noet :*/ |