Use memset; might be faster if someone used this for a biiig string.
authorOwen Taylor <otaylor@redhat.com>
Wed, 26 Sep 2001 15:26:44 +0000 (15:26 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 26 Sep 2001 15:26:44 +0000 (15:26 +0000)
Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>

* glib/gstrfuncs.c (g_strnfill): Use memset; might be
faster if someone used this for a biiig string.
(Suggestion from Jakub Jelinek)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gstrfuncs.c

index a0e2d16..bf060ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gstrfuncs.c (g_strnfill): Use memset; might be 
+       faster if someone used this for a biiig string.
+       (Suggestion from Jakub Jelinek)
+
 2001-09-26  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: (Win32:) Move the Win32 check closer to the start,
index a0e2d16..bf060ee 100644 (file)
@@ -1,3 +1,9 @@
+Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gstrfuncs.c (g_strnfill): Use memset; might be 
+       faster if someone used this for a biiig string.
+       (Suggestion from Jakub Jelinek)
+
 2001-09-26  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: (Win32:) Move the Win32 check closer to the start,
index a0e2d16..bf060ee 100644 (file)
@@ -1,3 +1,9 @@
+Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gstrfuncs.c (g_strnfill): Use memset; might be 
+       faster if someone used this for a biiig string.
+       (Suggestion from Jakub Jelinek)
+
 2001-09-26  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: (Win32:) Move the Win32 check closer to the start,
index a0e2d16..bf060ee 100644 (file)
@@ -1,3 +1,9 @@
+Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gstrfuncs.c (g_strnfill): Use memset; might be 
+       faster if someone used this for a biiig string.
+       (Suggestion from Jakub Jelinek)
+
 2001-09-26  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: (Win32:) Move the Win32 check closer to the start,
index a0e2d16..bf060ee 100644 (file)
@@ -1,3 +1,9 @@
+Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gstrfuncs.c (g_strnfill): Use memset; might be 
+       faster if someone used this for a biiig string.
+       (Suggestion from Jakub Jelinek)
+
 2001-09-26  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: (Win32:) Move the Win32 check closer to the start,
index a0e2d16..bf060ee 100644 (file)
@@ -1,3 +1,9 @@
+Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gstrfuncs.c (g_strnfill): Use memset; might be 
+       faster if someone used this for a biiig string.
+       (Suggestion from Jakub Jelinek)
+
 2001-09-26  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: (Win32:) Move the Win32 check closer to the start,
index a0e2d16..bf060ee 100644 (file)
@@ -1,3 +1,9 @@
+Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gstrfuncs.c (g_strnfill): Use memset; might be 
+       faster if someone used this for a biiig string.
+       (Suggestion from Jakub Jelinek)
+
 2001-09-26  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: (Win32:) Move the Win32 check closer to the start,
index a0e2d16..bf060ee 100644 (file)
@@ -1,3 +1,9 @@
+Wed Sep 26 11:00:31 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gstrfuncs.c (g_strnfill): Use memset; might be 
+       faster if someone used this for a biiig string.
+       (Suggestion from Jakub Jelinek)
+
 2001-09-26  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: (Win32:) Move the Win32 check closer to the start,
index 838694f..5f2b4ce 100644 (file)
@@ -133,14 +133,11 @@ gchar*
 g_strnfill (gsize length,     
            gchar fill_char)
 {
-  register gchar *str, *s, *end;
+  gchar *str;
 
   str = g_new (gchar, length + 1);
-  s = str;
-  end = str + length;
-  while (s < end)
-    *(s++) = fill_char;
-  *s = 0;
+  memset (str, (guchar)fill_char, length);
+  str[length] = '\0';
 
   return str;
 }