From 49fb6c6cc28dad0049b8e5a94c2cd2762f75baab Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sun, 2 Sep 2001 17:14:23 +0000 Subject: [PATCH] Replace some uses of isspace() with g_ascii_isspace(). Sun Sep 2 13:05:53 2001 Owen Taylor * glib/gstrfuncs.c (g_strchomp): Replace some uses of isspace() with g_ascii_isspace(). * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add extra indirections to g_utf8_skip and g_ascii_table to avoid great whopping copy relocs. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-0 | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-12 | 9 +++++++++ ChangeLog.pre-2-2 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ glib/gstrfuncs.c | 8 +++++--- glib/gstrfuncs.h | 2 +- glib/gunicode.h | 4 +--- glib/gutf8.c | 4 +++- 12 files changed, 82 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2a9e13..c3bd76a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sun Sep 2 13:05:53 2001 Owen Taylor + + * glib/gstrfuncs.c (g_strchomp): Replace some uses + of isspace() with g_ascii_isspace(). + + * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add + extra indirections to g_utf8_skip and g_ascii_table to + avoid great whopping copy relocs. + Sun Sep 2 11:10:42 2001 Owen Taylor * glib/gen-unicode-tables.pl glib/gunicomp.h diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index d2a9e13..c3bd76a 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +Sun Sep 2 13:05:53 2001 Owen Taylor + + * glib/gstrfuncs.c (g_strchomp): Replace some uses + of isspace() with g_ascii_isspace(). + + * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add + extra indirections to g_utf8_skip and g_ascii_table to + avoid great whopping copy relocs. + Sun Sep 2 11:10:42 2001 Owen Taylor * glib/gen-unicode-tables.pl glib/gunicomp.h diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d2a9e13..c3bd76a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Sun Sep 2 13:05:53 2001 Owen Taylor + + * glib/gstrfuncs.c (g_strchomp): Replace some uses + of isspace() with g_ascii_isspace(). + + * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add + extra indirections to g_utf8_skip and g_ascii_table to + avoid great whopping copy relocs. + Sun Sep 2 11:10:42 2001 Owen Taylor * glib/gen-unicode-tables.pl glib/gunicomp.h diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index d2a9e13..c3bd76a 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +Sun Sep 2 13:05:53 2001 Owen Taylor + + * glib/gstrfuncs.c (g_strchomp): Replace some uses + of isspace() with g_ascii_isspace(). + + * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add + extra indirections to g_utf8_skip and g_ascii_table to + avoid great whopping copy relocs. + Sun Sep 2 11:10:42 2001 Owen Taylor * glib/gen-unicode-tables.pl glib/gunicomp.h diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d2a9e13..c3bd76a 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +Sun Sep 2 13:05:53 2001 Owen Taylor + + * glib/gstrfuncs.c (g_strchomp): Replace some uses + of isspace() with g_ascii_isspace(). + + * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add + extra indirections to g_utf8_skip and g_ascii_table to + avoid great whopping copy relocs. + Sun Sep 2 11:10:42 2001 Owen Taylor * glib/gen-unicode-tables.pl glib/gunicomp.h diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d2a9e13..c3bd76a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Sun Sep 2 13:05:53 2001 Owen Taylor + + * glib/gstrfuncs.c (g_strchomp): Replace some uses + of isspace() with g_ascii_isspace(). + + * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add + extra indirections to g_utf8_skip and g_ascii_table to + avoid great whopping copy relocs. + Sun Sep 2 11:10:42 2001 Owen Taylor * glib/gen-unicode-tables.pl glib/gunicomp.h diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d2a9e13..c3bd76a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Sun Sep 2 13:05:53 2001 Owen Taylor + + * glib/gstrfuncs.c (g_strchomp): Replace some uses + of isspace() with g_ascii_isspace(). + + * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add + extra indirections to g_utf8_skip and g_ascii_table to + avoid great whopping copy relocs. + Sun Sep 2 11:10:42 2001 Owen Taylor * glib/gen-unicode-tables.pl glib/gunicomp.h diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d2a9e13..c3bd76a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Sun Sep 2 13:05:53 2001 Owen Taylor + + * glib/gstrfuncs.c (g_strchomp): Replace some uses + of isspace() with g_ascii_isspace(). + + * glib/gutf8.c glib/gunicode.h glib/gstrfuncs.[ch]: Add + extra indirections to g_utf8_skip and g_ascii_table to + avoid great whopping copy relocs. + Sun Sep 2 11:10:42 2001 Owen Taylor * glib/gen-unicode-tables.pl glib/gunicomp.h diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index af3b99c..3708248 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -56,7 +56,7 @@ #if defined(G_PLATFORM_WIN32) && defined(__GNUC__) __declspec(dllexport) #endif -const guint16 g_ascii_table[256] = { +static const guint16 ascii_table_data[256] = { 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x104, 0x104, 0x004, 0x104, 0x104, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, @@ -76,6 +76,8 @@ const guint16 g_ascii_table[256] = { /* the upper 128 are all zeroes */ }; +const guint16 * const g_ascii_table = ascii_table_data; + gchar* g_strdup (const gchar *str) { @@ -1521,7 +1523,7 @@ g_strchug (gchar *string) g_return_val_if_fail (string != NULL, NULL); - for (start = (guchar*) string; *start && isspace (*start); start++) + for (start = (guchar*) string; *start && g_ascii_isspace (*start); start++) ; g_memmove (string, start, strlen ((gchar *) start) + 1); @@ -1539,7 +1541,7 @@ g_strchomp (gchar *string) if (!*string) return string; - for (s = string + strlen (string) - 1; s >= string && isspace ((guchar)*s); + for (s = string + strlen (string) - 1; s >= string && g_ascii_isspace ((guchar)*s); s--) *s = '\0'; diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h index 1dfb024..62f0e47 100644 --- a/glib/gstrfuncs.h +++ b/glib/gstrfuncs.h @@ -47,7 +47,7 @@ typedef enum { G_ASCII_XDIGIT = 1 << 10 } GAsciiType; -GLIB_VAR const guint16 g_ascii_table[256]; +GLIB_VAR const guint16 * const g_ascii_table; #define g_ascii_isalnum(c) \ ((g_ascii_table[(guchar) (c)] & G_ASCII_ALNUM) != 0) diff --git a/glib/gunicode.h b/glib/gunicode.h index c130955..f93f3b1 100644 --- a/glib/gunicode.h +++ b/glib/gunicode.h @@ -160,10 +160,8 @@ gunichar *g_unicode_canonical_decomposition (gunichar ch, gsize *result_len); /* Array of skip-bytes-per-initial character. - * We prefix variable declarations so they can - * properly get exported in Windows DLLs. */ -GLIB_VAR char g_utf8_skip[256]; +GLIB_VAR const gchar * const g_utf8_skip; #define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(guchar *)(p)]) diff --git a/glib/gutf8.c b/glib/gutf8.c index 567fcbc..a858780 100644 --- a/glib/gutf8.c +++ b/glib/gutf8.c @@ -99,7 +99,7 @@ (Char) != 0xFFFE && (Char) != 0xFFFF) -gchar g_utf8_skip[256] = { +static const gchar utf8_skip_data[256] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -110,6 +110,8 @@ gchar g_utf8_skip[256] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0 }; +const gchar * const g_utf8_skip = utf8_skip_data; + /** * g_utf8_find_prev_char: * @str: pointer to the beginning of a UTF-8 string -- 2.7.4