[glib] g_str_hash: clean up code
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] g_str_hash: clean up code
- Date: Wed, 17 Nov 2010 17:30:38 +0000 (UTC)
commit f50a99e7827f4b906cfe9ced27096b047f65ac80
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Nov 17 11:57:48 2010 -0500
g_str_hash: clean up code
Un-unroll the first iteration.
No functional changes here.
glib/gstring.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/glib/gstring.c b/glib/gstring.c
index 9b25fb6..946206f 100644
--- a/glib/gstring.c
+++ b/glib/gstring.c
@@ -130,12 +130,11 @@ guint
g_str_hash (gconstpointer v)
{
/* 31 bit hash function */
- const signed char *p = v;
- guint32 h = *p;
+ const signed char *p;
+ guint32 h = 0;
- if (h)
- for (p += 1; *p != '\0'; p++)
- h = (h << 5) - h + *p;
+ for (p = v; *p != '\0'; p++)
+ h = (h << 5) - h + *p;
return h;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]