about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2014-11-24 15:09:07 +0000
committerWilco Dijkstra <wdijkstr@arm.com>2014-11-24 15:09:07 +0000
commitb863d2bc4db728213e54ff502d2c3ae5dfa0db25 (patch)
treebd4d8a4941c175859100cc681cb8b038599dd41b
parent5d178c37a09748f720af1f0d1279ca513326f952 (diff)
downloadglibc-b863d2bc4db728213e54ff502d2c3ae5dfa0db25.tar.gz
glibc-b863d2bc4db728213e54ff502d2c3ae5dfa0db25.tar.xz
glibc-b863d2bc4db728213e54ff502d2c3ae5dfa0db25.zip
Improve strcpy performance.
-rw-r--r--ChangeLog5
-rw-r--r--string/strcpy.c13
2 files changed, 6 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 058c5a4c89..5e45a58779 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-23  Wilco Dijkstra  <wdijkstr@arm.com>
+
+	* string/strcpy.c (strcpy):
+	Improve performance by using strlen and memcpy.
+
 2014-11-24  Leonhard Holz  <leonhard.holz@web.de>
 
 	* string/strcoll_l.c (get_next_seq): __always_inline.
diff --git a/string/strcpy.c b/string/strcpy.c
index caa234a691..91f9cc640e 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)