Skip to content

Commit

Permalink
liblegacy: Added a C-string duplication function
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 12, 2014
1 parent 9aea6ac commit f1ce4b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doomsday/liblegacy/include/de/memory.h
Expand Up @@ -58,6 +58,8 @@ DENG_PUBLIC void *M_MemDup(void const *ptr, size_t size);

DENG_PUBLIC void M_Free(void *ptr);

DENG_PUBLIC char *M_StrDup(char const *str);

#ifdef __cplusplus
} // extern "C"
#endif
Expand Down
6 changes: 6 additions & 0 deletions doomsday/liblegacy/src/memory.c
Expand Up @@ -62,3 +62,9 @@ void M_Free(void *ptr)
{
free(ptr);
}

char *M_StrDup(char const *str)
{
if(!str) return 0;
return M_MemDup(str, strlen(str) + 1);
}

0 comments on commit f1ce4b7

Please sign in to comment.