From: Havoc Pennington Date: Mon, 20 Nov 2000 15:14:14 +0000 (+0000) Subject: Use a switch here, maybe helps the compiler optimize things. Also, ' ' is X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=399ad0b8b01f9694e561502f17066f585918cb57;p=dana%2Fcg-glib.git Use a switch here, maybe helps the compiler optimize things. Also, ' ' is 2000-11-16 Havoc Pennington * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, so don't special case it. --- diff --git a/ChangeLog b/ChangeLog index f0cd3ce4..c01c529f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-11-16 Havoc Pennington + + * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps + the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, + so don't special case it. + 2000-11-17 Tor Lillqvist * glib.def: Add g_trash_stack entry points. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index f0cd3ce4..c01c529f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +2000-11-16 Havoc Pennington + + * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps + the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, + so don't special case it. + 2000-11-17 Tor Lillqvist * glib.def: Add g_trash_stack entry points. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f0cd3ce4..c01c529f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2000-11-16 Havoc Pennington + + * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps + the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, + so don't special case it. + 2000-11-17 Tor Lillqvist * glib.def: Add g_trash_stack entry points. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index f0cd3ce4..c01c529f 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,9 @@ +2000-11-16 Havoc Pennington + + * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps + the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, + so don't special case it. + 2000-11-17 Tor Lillqvist * glib.def: Add g_trash_stack entry points. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index f0cd3ce4..c01c529f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +2000-11-16 Havoc Pennington + + * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps + the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, + so don't special case it. + 2000-11-17 Tor Lillqvist * glib.def: Add g_trash_stack entry points. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f0cd3ce4..c01c529f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +2000-11-16 Havoc Pennington + + * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps + the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, + so don't special case it. + 2000-11-17 Tor Lillqvist * glib.def: Add g_trash_stack entry points. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f0cd3ce4..c01c529f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2000-11-16 Havoc Pennington + + * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps + the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, + so don't special case it. + 2000-11-17 Tor Lillqvist * glib.def: Add g_trash_stack entry points. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f0cd3ce4..c01c529f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2000-11-16 Havoc Pennington + + * guniprop.c (g_unichar_isspace): Use a switch here, maybe helps + the compiler optimize things. Also, ' ' is a SPACE_SEPARATOR, + so don't special case it. + 2000-11-17 Tor Lillqvist * glib.def: Add g_trash_stack entry points. diff --git a/glib/guniprop.c b/glib/guniprop.c index c45fc7ab..8a1b41d6 100644 --- a/glib/guniprop.c +++ b/glib/guniprop.c @@ -118,15 +118,24 @@ g_unichar_ispunct (gunichar c) gboolean g_unichar_isspace (gunichar c) { - /* special-case these since Unicode thinks they are not spaces */ - if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || - c == '\f' || c == '\v') /* "the mythical vertical tab" */ - return TRUE; - else + switch (c) { - int t = TYPE (c); - return (t == G_UNICODE_SPACE_SEPARATOR || t == G_UNICODE_LINE_SEPARATOR - || t == G_UNICODE_PARAGRAPH_SEPARATOR); + /* special-case these since Unicode thinks they are not spaces */ + case '\t': + case '\n': + case '\r': + case '\f': + case '\v': /* vertical tab - as if anyone has ever used this... */ + return TRUE; + break; + + default: + { + int t = TYPE (c); + return (t == G_UNICODE_SPACE_SEPARATOR || t == G_UNICODE_LINE_SEPARATOR + || t == G_UNICODE_PARAGRAPH_SEPARATOR); + } + break; } } diff --git a/guniprop.c b/guniprop.c index c45fc7ab..8a1b41d6 100644 --- a/guniprop.c +++ b/guniprop.c @@ -118,15 +118,24 @@ g_unichar_ispunct (gunichar c) gboolean g_unichar_isspace (gunichar c) { - /* special-case these since Unicode thinks they are not spaces */ - if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || - c == '\f' || c == '\v') /* "the mythical vertical tab" */ - return TRUE; - else + switch (c) { - int t = TYPE (c); - return (t == G_UNICODE_SPACE_SEPARATOR || t == G_UNICODE_LINE_SEPARATOR - || t == G_UNICODE_PARAGRAPH_SEPARATOR); + /* special-case these since Unicode thinks they are not spaces */ + case '\t': + case '\n': + case '\r': + case '\f': + case '\v': /* vertical tab - as if anyone has ever used this... */ + return TRUE; + break; + + default: + { + int t = TYPE (c); + return (t == G_UNICODE_SPACE_SEPARATOR || t == G_UNICODE_LINE_SEPARATOR + || t == G_UNICODE_PARAGRAPH_SEPARATOR); + } + break; } }