From: Richard Earnshaw Date: Tue, 23 Dec 2014 16:57:07 +0000 (-0800) Subject: * string/stpcpy.c (__stpcpy): Rewrite using strlen and memcpy. X-Git-Tag: glibc-2.21~158 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f559d8cf29;p=thirdparty%2Fglibc.git * string/stpcpy.c (__stpcpy): Rewrite using strlen and memcpy. --- diff --git a/ChangeLog b/ChangeLog index 2b6f0adbb2c..9ed06fd0ff4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-12-23 Richard Earnshaw + + * string/stpcpy.c (__stpcpy): Rewrite using strlen and memcpy. + 2014-12-23 Florian Weimer * iconvdata/run-iconv-test.sh: Actually test iconv modules. diff --git a/string/stpcpy.c b/string/stpcpy.c index 9185acc0341..fd6eb1c3dee 100644 --- a/string/stpcpy.c +++ b/string/stpcpy.c @@ -35,14 +35,8 @@ __stpcpy (dest, src) char *dest; const char *src; { - char *d = dest; - const char *s = src; - - do - *d++ = *s; - while (*s++ != '\0'); - - return d - 1; + size_t len = strlen (src); + return memcpy (dest, src, len + 1) + len; } #ifdef libc_hidden_def libc_hidden_def (__stpcpy)