Merge pull request #42 from ccawley2011/rwstrdup

Replace use of strdup with rwstrdup
This commit is contained in:
aap
2021-01-14 00:34:13 +01:00
committed by GitHub
5 changed files with 18 additions and 21 deletions
+10
View File
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <new>
@@ -156,6 +157,15 @@ void *mustrealloc_h(void *p, size_t sz, uint32 hint)
return nil;
}
char *strdup_LOC(const char *s, uint32 hint, const char *here) {
char *t;
size_t sz = strlen(s)+1;
t = (char*)malloc_LOC(sz, hint, here);
if(t)
memcpy(t, s, sz);
return t;
}
MemoryFunctions defaultMemfuncs = {
malloc_h,
realloc_h,