I recently became aware that the strdup()
function I\'ve enjoyed using so much on OS X is not part of ANSI C, but part of POSIX. I don\'t want to rewrite all my
you could just use a macro like this, this way you can use the old name, but linker will see a different name;
char *my_strdup(const char *s) {
char *p = malloc(strlen(s) + 1);
if(p) { strcpy(p, s); }
return p;
}
/* this goes in whatever header defines my_strdup */
char *my_strdup(const char *s);
#define strdup(x) my_strdup(x)