PageRenderTime 41ms CodeModel.GetById 34ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/contrib/ntp/libopts/compat/strdup.c

https://bitbucket.org/freebsd/freebsd-head/
C | 19 lines | 11 code | 5 blank | 3 comment | 4 complexity | 04d06a56f0a663b2f045137965e2bebf MD5 | raw file
 1/*
 2 * Platforms without strdup ?!?!?!
 3 */
 4
 5static char *
 6strdup( char const *s )
 7{
 8    char *cp;
 9
10    if (s == NULL)
11        return NULL;
12
13    cp = (char *) AGALOC((unsigned) (strlen(s)+1), "strdup");
14
15    if (cp != NULL)
16        (void) strcpy(cp, s);
17
18    return cp;
19}