diff options
author | bde <bde@FreeBSD.org> | 1994-09-05 13:41:33 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1994-09-05 13:41:33 +0000 |
commit | 2933861562a299e76039fd27375792df944bb83d (patch) | |
tree | 2c66fae4984761c9c9ad914e37ea96e59920d79a | |
parent | ed0e48f6c02e14af37f292052c91b653fa08fedc (diff) | |
download | FreeBSD-src-2933861562a299e76039fd27375792df944bb83d.zip FreeBSD-src-2933861562a299e76039fd27375792df944bb83d.tar.gz |
Don't include <sys/types.h> to get u_int or use u_int for a bogus cast.
Modernize bcopy -> memcpy.
-rw-r--r-- | lib/libc/string/strdup.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/libc/string/strdup.c b/lib/libc/string/strdup.c index 6fa50ce..a1c2eed 100644 --- a/lib/libc/string/strdup.c +++ b/lib/libc/string/strdup.c @@ -35,8 +35,6 @@ static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -#include <sys/types.h> - #include <stddef.h> #include <stdlib.h> #include <string.h> @@ -49,8 +47,8 @@ strdup(str) char *copy; len = strlen(str) + 1; - if (!(copy = malloc((u_int)len))) + if ((copy = malloc(len)) == NULL) return (NULL); - bcopy(str, copy, len); + memcpy(copy, str, len); return (copy); } |