diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-09 17:56:59 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-09 17:56:59 +0100 |
commit | 002a1b035e2464c11b17f1bfd3835deccef7652a (patch) | |
tree | 640baf35dce60566a8f14eec54212af848e5ad71 /src/common/string.c | |
parent | f2c51bc81d2aa618b29ddbeaae5ac1c5308821f0 (diff) | |
download | kogata-002a1b035e2464c11b17f1bfd3835deccef7652a.tar.gz kogata-002a1b035e2464c11b17f1bfd3835deccef7652a.zip |
Change readme, remove unused code, changed hashtbl to add key freeing function.
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 :*/ |