Changeset View
Changeset View
Standalone View
Standalone View
sys/libkern/strdup.c
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | strdup_flags(const char *string, struct malloc_type *type, int flags) | ||||
copy = malloc(len, type, flags); | copy = malloc(len, type, flags); | ||||
if (copy == NULL) | if (copy == NULL) | ||||
return (NULL); | return (NULL); | ||||
bcopy(string, copy, len); | bcopy(string, copy, len); | ||||
return (copy); | return (copy); | ||||
} | } | ||||
char * | char * | ||||
strdup(const char *string, struct malloc_type *type) | strdup(const char * __restrict string, struct malloc_type *type) | ||||
{ | { | ||||
return (strdup_flags(string, type, M_WAITOK)); | return (strdup_flags(string, type, M_WAITOK)); | ||||
} | } |