From: Wilco Dijkstra Date: Mon, 24 Nov 2014 15:09:07 +0000 (+0000) Subject: Improve strcpy performance. X-Git-Tag: glibc-2.21~339 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b863d2bc4db728213e54ff502d2c3ae5dfa0db25;p=platform%2Fupstream%2Fglibc.git Improve strcpy performance. --- diff --git a/ChangeLog b/ChangeLog index 058c5a4..5e45a58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-09-23 Wilco Dijkstra + + * string/strcpy.c (strcpy): + Improve performance by using strlen and memcpy. + 2014-11-24 Leonhard Holz * string/strcoll_l.c (get_next_seq): __always_inline. diff --git a/string/strcpy.c b/string/strcpy.c index caa234a..91f9cc6 100644 --- a/string/strcpy.c +++ b/string/strcpy.c @@ -24,17 +24,6 @@ char * strcpy (char *dest, const char *src) { - char c; - char *s = (char *) src; - const ptrdiff_t off = dest - s - 1; - - do - { - c = *s++; - s[off] = c; - } - while (c != '\0'); - - return dest; + return memcpy (dest, src, strlen (src) + 1)); } libc_hidden_builtin_def (strcpy)