Patch from Andrew Taylor to optimize the decomposition table to eliminate

Tue Nov 20 20:54:25 2001  Owen Taylor  <otaylor@redhat.com>
	* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
	from Andrew Taylor to optimize the decomposition table
	to eliminate relocations and save space. (#64982)
This commit is contained in:
Owen Taylor 2001-11-21 01:57:10 +00:00 committed by Owen Taylor
parent f4fd840eaf
commit 2bbd00a263
11 changed files with 6292 additions and 3497 deletions

View File

@ -1,3 +1,9 @@
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
from Andrew Taylor to optimize the decomposition table
to eliminate relocations and save space. (#64982)
2001-11-18 Hans Breuer <hans@breuer.org>
* glib/glib.def :

View File

@ -1,3 +1,9 @@
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
from Andrew Taylor to optimize the decomposition table
to eliminate relocations and save space. (#64982)
2001-11-18 Hans Breuer <hans@breuer.org>
* glib/glib.def :

View File

@ -1,3 +1,9 @@
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
from Andrew Taylor to optimize the decomposition table
to eliminate relocations and save space. (#64982)
2001-11-18 Hans Breuer <hans@breuer.org>
* glib/glib.def :

View File

@ -1,3 +1,9 @@
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
from Andrew Taylor to optimize the decomposition table
to eliminate relocations and save space. (#64982)
2001-11-18 Hans Breuer <hans@breuer.org>
* glib/glib.def :

View File

@ -1,3 +1,9 @@
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
from Andrew Taylor to optimize the decomposition table
to eliminate relocations and save space. (#64982)
2001-11-18 Hans Breuer <hans@breuer.org>
* glib/glib.def :

View File

@ -1,3 +1,9 @@
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
from Andrew Taylor to optimize the decomposition table
to eliminate relocations and save space. (#64982)
2001-11-18 Hans Breuer <hans@breuer.org>
* glib/glib.def :

View File

@ -1,3 +1,9 @@
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
from Andrew Taylor to optimize the decomposition table
to eliminate relocations and save space. (#64982)
2001-11-18 Hans Breuer <hans@breuer.org>
* glib/glib.def :

View File

@ -1,3 +1,9 @@
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
from Andrew Taylor to optimize the decomposition table
to eliminate relocations and save space. (#64982)
2001-11-18 Hans Breuer <hans@breuer.org>
* glib/glib.def :

View File

@ -707,12 +707,14 @@ sub print_decomp
print OUT " unsigned short ch;\n";
print OUT " unsigned char canon_offset;\n";
print OUT " unsigned char compat_offset;\n";
print OUT " unsigned char *expansion;\n";
print OUT " unsigned short expansion_offset;\n";
print OUT "} decomposition;\n\n";
print OUT "static const decomposition decomp_table[] =\n{\n";
my ($iter);
my ($first) = 1;
my ($decomp_string) = "";
my ($decomp_string_offset) = 0;
for ($count = 0; $count <= $last; ++$count)
{
if (defined $decompositions[$count])
@ -749,18 +751,25 @@ sub print_decomp
$string .= $compat_decomp;
}
$bytes_out += (length $string) / 4; # "\x20"
if (!defined($decomp_offsets{$string})) {
$decomp_offsets{$string} = $decomp_string_offset;
$decomp_string .= "\n \"".$string."\\0\\0\" /* offset ".
$decomp_string_offset." */";
$decomp_string_offset += ((length $string) / 4) + 2;
# Only a single terminator because one is implied in the string.
printf OUT qq( { 0x%04x, %u, %u, "%s\\0" }),
$count, $canon_offset, $compat_offset, $string;
$bytes_out += (length $string) / 4 + 2; # "\x20"
}
printf OUT qq( { 0x%04x, %u, %u, %d }),
$count, $canon_offset, $compat_offset, $decomp_offsets{$string};
$bytes_out += 6;
}
}
print OUT "\n};\n\n";
printf OUT "static const char decomp_expansion_string[] = %s;\n\n", $decomp_string;
print OUT "#endif /* DECOMP_H */\n";
printf STDERR "Generated %d bytes in decomp tables\n", $bytes_out;

View File

@ -83,7 +83,7 @@ g_unicode_canonical_ordering (gunichar *string,
}
}
static guchar *
static const guchar *
find_decomposition (gunichar ch,
gboolean compat)
{
@ -113,7 +113,7 @@ find_decomposition (gunichar ch,
return NULL;
}
return decomp_table[half].expansion + offset;
return &(decomp_expansion_string[decomp_table[half].expansion_offset + offset]);
}
else if (half == start)
break;
@ -141,7 +141,7 @@ gunichar *
g_unicode_canonical_decomposition (gunichar ch,
gsize *result_len)
{
guchar *decomp = find_decomposition (ch, FALSE);
const guchar *decomp = find_decomposition (ch, FALSE);
gunichar *r;
if (decomp)
@ -251,7 +251,7 @@ _g_utf8_normalize_wc (const gchar *str,
{
gunichar wc = g_utf8_get_char (p);
guchar *decomp = find_decomposition (wc, do_compat);
const guchar *decomp = find_decomposition (wc, do_compat);
if (decomp)
{
@ -276,7 +276,7 @@ _g_utf8_normalize_wc (const gchar *str,
while ((max_len < 0 || p < str + max_len) && *p)
{
gunichar wc = g_utf8_get_char (p);
guchar *decomp;
const guchar *decomp;
int cc;
gsize old_n_wc = n_wc;

File diff suppressed because it is too large Load Diff