summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-01-13 15:03:46 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-01-15 08:43:07 -0800
commit3d27f14d247b988f3a226dce0112f7e0a69f5c30 (patch)
tree71a148ddbf4f83e4a302cf0ff7bbb5dea7b89e06
parentf57d833a807aa443a89e54c518a64df1cdecbe77 (diff)
downloadglibc-hjl/pr19463.tar.gz
Avoid strdup/strndup/strsephjl/pr19463
-rw-r--r--include/string.h7
-rw-r--r--string/strsep.c1
2 files changed, 8 insertions, 0 deletions
diff --git a/include/string.h b/include/string.h
index e145bfdb4c..151e420478 100644
--- a/include/string.h
+++ b/include/string.h
@@ -71,6 +71,12 @@ extern __typeof (strncasecmp_l) __strncasecmp_l;
__new[__len] = '\0'; \
(char *) memcpy (__new, __old, __len); \
}))
+
+# ifdef __OPTIMIZE_SIZE__
+# define strdup(s) __strdup ((s))
+# define strndup(s, n) __strndup ((s), (n))
+# define strsep(s, d) __strsep ((s), (d))
+# endif
#endif
libc_hidden_proto (__mempcpy)
@@ -99,6 +105,7 @@ libc_hidden_proto (memmem)
extern __typeof (memmem) __memmem;
libc_hidden_proto (__memmem)
libc_hidden_proto (__ffs)
+libc_hidden_proto (__strsep)
libc_hidden_builtin_proto (memchr)
libc_hidden_builtin_proto (memcpy)
diff --git a/string/strsep.c b/string/strsep.c
index 1054774048..1d98885e22 100644
--- a/string/strsep.c
+++ b/string/strsep.c
@@ -66,4 +66,5 @@ __strsep (char **stringp, const char *delim)
}
weak_alias (__strsep, strsep)
strong_alias (__strsep, __strsep_g)
+libc_hidden_def (__strsep)
libc_hidden_def (__strsep_g)