Don't include <sys/types.h> to get u_int or use u_int for a bogus cast.
Modernize bcopy -> memcpy.
This commit is contained in:
parent
5ec11cf0bb
commit
aeeb6869a5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2506
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user