Merge pull request #42 from ccawley2011/rwstrdup
Replace use of strdup with rwstrdup
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user