Deleted Added
full compact
strdup.c (82498) strdup.c (106163)
1#include "ntp_malloc.h"
1
2
3#if !HAVE_STRDUP
4
2#define NULL 0
3
5#define NULL 0
6
7char *strdup(const char *s);
8
4char *
5strdup(
6 const char *s
7 )
8{
9 char *cp;
10
11 if (s) {
12 cp = (char *) malloc((unsigned) (strlen(s)+1));
13 if (cp) {
14 (void) strcpy(cp, s);
15 }
16 } else {
17 cp = (char *) NULL;
18 }
19 return(cp);
20}
9char *
10strdup(
11 const char *s
12 )
13{
14 char *cp;
15
16 if (s) {
17 cp = (char *) malloc((unsigned) (strlen(s)+1));
18 if (cp) {
19 (void) strcpy(cp, s);
20 }
21 } else {
22 cp = (char *) NULL;
23 }
24 return(cp);
25}
26#else
27int strdup_bs;
28#endif