We don't need to implement strdup
After defining _GNU_SOURCE
This commit is contained in:
parent
11b1ba397f
commit
c43ef2aedd
|
@ -33,5 +33,4 @@ char *cmdsep(char **stringp, const char *delim);
|
|||
// Split string into 2 by delim, handle quotes
|
||||
char *argsep(char **stringp, const char *delim);
|
||||
|
||||
char *strdup(const char *);
|
||||
#endif
|
||||
|
|
|
@ -362,12 +362,3 @@ char *argsep(char **stringp, const char *delim) {
|
|||
found:
|
||||
return start;
|
||||
}
|
||||
|
||||
char *strdup(const char *str) {
|
||||
char *dup = malloc(strlen(str) + 1);
|
||||
if (dup) {
|
||||
strcpy(dup, str);
|
||||
}
|
||||
return dup;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue