This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.20-245-g6423d47
- From: wilco at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 24 Nov 2014 15:19:24 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.20-245-g6423d47
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 6423d4754c3769129510b9b44b6b8cfe8192ec67 (commit)
via b863d2bc4db728213e54ff502d2c3ae5dfa0db25 (commit)
from 5d178c37a09748f720af1f0d1279ca513326f952 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6423d4754c3769129510b9b44b6b8cfe8192ec67
commit 6423d4754c3769129510b9b44b6b8cfe8192ec67
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date: Mon Nov 24 15:15:10 2014 +0000
Improve performance of strncpy.
diff --git a/ChangeLog b/ChangeLog
index 5e45a58..4e557a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-2014-09-23 Wilco Dijkstra <wdijkstr@arm.com>
+2014-11-24 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * string/strncpy.c (strncpy): Improve performance by using memset.
+
+2014-11-24 Wilco Dijkstra <wdijkstr@arm.com>
* string/strcpy.c (strcpy):
Improve performance by using strlen and memcpy.
diff --git a/string/strncpy.c b/string/strncpy.c
index 0915e03..d5fa5be 100644
--- a/string/strncpy.c
+++ b/string/strncpy.c
@@ -57,10 +57,10 @@ STRNCPY (char *s1, const char *s2, size_t n)
if (--n4 == 0)
goto last_chars;
}
- n = n - (s1 - s) - 1;
- if (n == 0)
- return s;
- goto zero_fill;
+ s1++;
+ n = n - (s1 - s);
+ memset (s1, '\0', n);
+ return s;
}
last_chars:
@@ -77,11 +77,7 @@ STRNCPY (char *s1, const char *s2, size_t n)
}
while (c != '\0');
- zero_fill:
- do
- *++s1 = '\0';
- while (--n > 0);
-
+ memset (s1 + 1, '\0', n);
return s;
}
libc_hidden_builtin_def (strncpy)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b863d2bc4db728213e54ff502d2c3ae5dfa0db25
commit b863d2bc4db728213e54ff502d2c3ae5dfa0db25
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date: Mon Nov 24 15:09:07 2014 +0000
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 <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 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)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 9 +++++++++
string/strcpy.c | 13 +------------
string/strncpy.c | 14 +++++---------
3 files changed, 15 insertions(+), 21 deletions(-)
hooks/post-receive
--
GNU C Library master sources