Browse Source

add my own strdup

1.0.2
Georg Hopp 12 years ago
parent
commit
988ce39e05
  1. 2
      include/tr/memory.h
  2. 15
      src/memory.c

2
include/tr/memory.h

@ -34,6 +34,8 @@ void TR_free(void **);
size_t TR_getSize(void *);
void TR_cleanup();
char * TR_strdup(const char *);
#endif // __TR_MEMORY_H__
// vim: set ts=4 sw=4:

15
src/memory.c

@ -505,4 +505,19 @@ TR_cleanup()
#endif
}
char *
TR_strdup(const char * src)
{
char * dup;
if (NULL == src) {
return NULL;
}
dup = TR_malloc(strlen(src)+1);
strcpy(dup, src);
return dup;
}
// vim: set ts=4 sw=4:
Loading…
Cancel
Save