Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136591147
D19259.id54100.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D19259.id54100.diff
View Options
Index: sys/libkern/strdup.c
===================================================================
--- sys/libkern/strdup.c
+++ sys/libkern/strdup.c
@@ -39,14 +39,24 @@
#include <sys/libkern.h>
#include <sys/malloc.h>
+
char *
-strdup(const char *string, struct malloc_type *type)
+strdup_flags(const char *string, struct malloc_type *type, int flags)
{
size_t len;
char *copy;
len = strlen(string) + 1;
- copy = malloc(len, type, M_WAITOK);
+ copy = malloc(len, type, flags);
+ if (copy == NULL)
+ return (NULL);
bcopy(string, copy, len);
return (copy);
}
+
+char *
+strdup(const char *string, struct malloc_type *type)
+{
+
+ return (strdup_flags(string, type, M_WAITOK));
+}
Index: sys/sys/libkern.h
===================================================================
--- sys/sys/libkern.h
+++ sys/sys/libkern.h
@@ -173,6 +173,7 @@
int strcmp(const char *, const char *);
char *strcpy(char * __restrict, const char * __restrict);
size_t strcspn(const char * __restrict, const char * __restrict) __pure;
+char *strdup_flags(const char *__restrict, struct malloc_type *, int);
char *strdup(const char *__restrict, struct malloc_type *);
char *strncat(char *, const char *, size_t);
char *strndup(const char *__restrict, size_t, struct malloc_type *);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 19, 12:01 PM (2 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25629397
Default Alt Text
D19259.id54100.diff (1 KB)
Attached To
Mode
D19259: make _flags variant of strdup
Attached
Detach File
Event Timeline
Log In to Comment