cvs: pecl /translit translit.c /translit/data convert.php cyrillic_transliterate.c diacritical_remove.c greek_transliterate.c han_transliterate.c
hebrew_transliterate.c jamo_transliterate.c lowercase_cyrillic.c lowercase_greek.c lowercase_latin.c normalize_ligature.c normalize_punctuation.c
numbers.c special_decompose.c uppercase_cyrillic.c uppercase_greek.c uppercase_latin.c

From: Date: Fri, 12 Nov 2004 19:37:39 +0000
Subject: cvs: pecl /translit translit.c /translit/data convert.php cyrillic_transliterate.c diacritical_remove.c greek_transliterate.c han_transliterate.c
hebrew_transliterate.c jamo_transliterate.c lowercase_cyrillic.c lowercase_greek.c lowercase_latin.c normalize_ligature.c normalize_punctuation.c
numbers.c special_decompose.c uppercase_cyrillic.c uppercase_greek.c uppercase_latin.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-2025@lists.php.net to get a copy of this message
derick Fri Nov 12 14:37:39 2004 EDT Modified files: /pecl/translit translit.c /pecl/translit/data convert.php cyrillic_transliterate.c diacritical_remove.c greek_transliterate.c han_transliterate.c hebrew_transliterate.c jamo_transliterate.c lowercase_cyrillic.c lowercase_greek.c lowercase_latin.c normalize_ligature.c normalize_punctuation.c numbers.c special_decompose.c uppercase_cyrillic.c uppercase_greek.c uppercase_latin.c Log: - Changed the code generator to only generate switch cases for the actions that are actually used in the conversion function.

http://cvs.php.net/diff.php/pecl/translit/translit.c?r1=1.6&r2=1.7&ty=u Index: pecl/translit/translit.c diff -u pecl/translit/translit.c:1.6 pecl/translit/translit.c:1.7 --- pecl/translit/translit.c:1.6 Thu Nov 11 11:28:17 2004 +++ pecl/translit/translit.c Fri Nov 12 14:37:35 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: translit.c,v 1.6 2004/11/11 16:28:17 derick Exp $ */ +/* $Id: translit.c,v 1.7 2004/11/12 19:37:35 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -27,7 +27,7 @@ #include "ext/standard/info.h" #include "php_translit.h" -ZEND_DECLARE_MODULE_GLOBALS(translit) +//ZEND_DECLARE_MODULE_GLOBALS(translit) /* {{{ translit_functions[] */ function_entry translit_functions[] = { http://cvs.php.net/diff.php/pecl/translit/data/convert.php?r1=1.6&r2=1.7&ty=u Index: pecl/translit/data/convert.php diff -u pecl/translit/data/convert.php:1.6 pecl/translit/data/convert.php:1.7 --- pecl/translit/data/convert.php:1.6 Thu Nov 11 11:28:19 2004 +++ pecl/translit/data/convert.php Fri Nov 12 14:37:38 2004 @@ -10,6 +10,7 @@ $expand_max_length = 0; $transpose = array(); $use_map = true; + $skip = false; define('JUMP_MAP', 1); define('JUMP_EXPAND', 2); @@ -50,6 +51,8 @@ $block = (int) ($cp / 256); if (!register_jump($cp, JUMP_REMOVE)) { echo "Code point $cp is already defined.\n"; + } else { + $GLOBALS['skip'] = true; } } @@ -251,9 +254,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us{$expand_max_length} *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -304,18 +314,37 @@ tmp_out[out_idx] = in[i]; out_idx++; break; + +ENDCODE; + if (count($map)) { + $txt .= <<<ENDCODE case 1: /* Simple mapping */ tmp_out[out_idx] = replace_map[cp]; out_idx++; break; + +ENDCODE; + } + if (count($expand)) { + $txt .= <<<ENDCODE case 2: /* Expand to more than one char */ for (j = 1; j <= expand_map[cp][0]; j++) { tmp_out[out_idx] = expand_map[cp][j]; out_idx++; } break; + +ENDCODE; + } + if ($GLOBALS['skip']) { + $txt .= <<<ENDCODE case 3: /* Skip */ break; + +ENDCODE; + } + if (count($transpose)) { + $txt .= <<<ENDCODE case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; @@ -324,6 +353,10 @@ tmp_out[out_idx] = in[i] - transpose_map[cp]; out_idx++; break; + +ENDCODE; + } + $txt .= <<<ENDCODE } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/cyrillic_transliterate.c?r1=1.5&r2=1.6&ty=u Index: pecl/translit/data/cyrillic_transliterate.c diff -u pecl/translit/data/cyrillic_transliterate.c:1.5 pecl/translit/data/cyrillic_transliterate.c:1.6 --- pecl/translit/data/cyrillic_transliterate.c:1.5 Thu Nov 11 11:28:19 2004 +++ pecl/translit/data/cyrillic_transliterate.c Fri Nov 12 14:37:38 2004 @@ -96,9 +96,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us3 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -140,16 +147,6 @@ out_idx++; } break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; @@ -247,9 +244,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us3 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -291,16 +295,6 @@ out_idx++; } break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/diacritical_remove.c?r1=1.6&r2=1.7&ty=u Index: pecl/translit/data/diacritical_remove.c diff -u pecl/translit/data/diacritical_remove.c:1.6 pecl/translit/data/diacritical_remove.c:1.7 --- pecl/translit/data/diacritical_remove.c:1.6 Thu Nov 11 11:28:19 2004 +++ pecl/translit/data/diacritical_remove.c Fri Nov 12 14:37:38 2004 @@ -178,9 +178,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -219,22 +226,6 @@ tmp_out[out_idx] = replace_map[cp]; out_idx++; break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/greek_transliterate.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/greek_transliterate.c diff -u pecl/translit/data/greek_transliterate.c:1.4 pecl/translit/data/greek_transliterate.c:1.5 --- pecl/translit/data/greek_transliterate.c:1.4 Thu Nov 11 11:28:19 2004 +++ pecl/translit/data/greek_transliterate.c Fri Nov 12 14:37:38 2004 @@ -96,9 +96,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us3 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -142,14 +149,6 @@ break; case 3: /* Skip */ break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/han_transliterate.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/han_transliterate.c diff -u pecl/translit/data/han_transliterate.c:1.4 pecl/translit/data/han_transliterate.c:1.5 --- pecl/translit/data/han_transliterate.c:1.4 Thu Nov 11 11:28:19 2004 +++ pecl/translit/data/han_transliterate.c Fri Nov 12 14:37:38 2004 @@ -6178,9 +6178,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us6 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -6321,26 +6328,12 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; case 2: /* Expand to more than one char */ for (j = 1; j <= expand_map[cp][0]; j++) { tmp_out[out_idx] = expand_map[cp][j]; out_idx++; } break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/hebrew_transliterate.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/hebrew_transliterate.c diff -u pecl/translit/data/hebrew_transliterate.c:1.4 pecl/translit/data/hebrew_transliterate.c:1.5 --- pecl/translit/data/hebrew_transliterate.c:1.4 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/hebrew_transliterate.c Fri Nov 12 14:37:38 2004 @@ -96,9 +96,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us2 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -142,14 +149,6 @@ break; case 3: /* Skip */ break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/jamo_transliterate.c?r1=1.2&r2=1.3&ty=u Index: pecl/translit/data/jamo_transliterate.c diff -u pecl/translit/data/jamo_transliterate.c:1.2 pecl/translit/data/jamo_transliterate.c:1.3 --- pecl/translit/data/jamo_transliterate.c:1.2 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/jamo_transliterate.c Fri Nov 12 14:37:38 2004 @@ -96,9 +96,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us3 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -140,16 +147,6 @@ out_idx++; } break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/lowercase_cyrillic.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/lowercase_cyrillic.c diff -u pecl/translit/data/lowercase_cyrillic.c:1.4 pecl/translit/data/lowercase_cyrillic.c:1.5 --- pecl/translit/data/lowercase_cyrillic.c:1.4 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/lowercase_cyrillic.c Fri Nov 12 14:37:38 2004 @@ -98,9 +98,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -133,18 +140,6 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; http://cvs.php.net/diff.php/pecl/translit/data/lowercase_greek.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/lowercase_greek.c diff -u pecl/translit/data/lowercase_greek.c:1.4 pecl/translit/data/lowercase_greek.c:1.5 --- pecl/translit/data/lowercase_greek.c:1.4 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/lowercase_greek.c Fri Nov 12 14:37:38 2004 @@ -58,9 +58,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -92,18 +99,6 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; http://cvs.php.net/diff.php/pecl/translit/data/lowercase_latin.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/lowercase_latin.c diff -u pecl/translit/data/lowercase_latin.c:1.4 pecl/translit/data/lowercase_latin.c:1.5 --- pecl/translit/data/lowercase_latin.c:1.4 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/lowercase_latin.c Fri Nov 12 14:37:38 2004 @@ -178,9 +178,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -215,18 +222,6 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; http://cvs.php.net/diff.php/pecl/translit/data/normalize_ligature.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/normalize_ligature.c diff -u pecl/translit/data/normalize_ligature.c:1.4 pecl/translit/data/normalize_ligature.c:1.5 --- pecl/translit/data/normalize_ligature.c:1.4 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/normalize_ligature.c Fri Nov 12 14:37:38 2004 @@ -130,9 +130,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us2 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -165,26 +172,12 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; case 2: /* Expand to more than one char */ for (j = 1; j <= expand_map[cp][0]; j++) { tmp_out[out_idx] = expand_map[cp][j]; out_idx++; } break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/normalize_punctuation.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/normalize_punctuation.c diff -u pecl/translit/data/normalize_punctuation.c:1.4 pecl/translit/data/normalize_punctuation.c:1.5 --- pecl/translit/data/normalize_punctuation.c:1.4 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/normalize_punctuation.c Fri Nov 12 14:37:38 2004 @@ -256,9 +256,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us2 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -306,14 +313,6 @@ break; case 3: /* Skip */ break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/numbers.c?r1=1.2&r2=1.3&ty=u Index: pecl/translit/data/numbers.c diff -u pecl/translit/data/numbers.c:1.2 pecl/translit/data/numbers.c:1.3 --- pecl/translit/data/numbers.c:1.2 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/numbers.c Fri Nov 12 14:37:38 2004 @@ -120,9 +120,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -159,14 +166,6 @@ tmp_out[out_idx] = replace_map[cp]; out_idx++; break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; @@ -234,9 +233,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -268,18 +274,6 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; @@ -1009,9 +1003,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -1063,14 +1064,6 @@ tmp_out[out_idx] = replace_map[cp]; out_idx++; break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; @@ -1200,9 +1193,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -1239,14 +1239,6 @@ tmp_out[out_idx] = replace_map[cp]; out_idx++; break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; @@ -1336,9 +1328,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -1374,14 +1373,6 @@ tmp_out[out_idx] = replace_map[cp]; out_idx++; break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; http://cvs.php.net/diff.php/pecl/translit/data/special_decompose.c?r1=1.2&r2=1.3&ty=u Index: pecl/translit/data/special_decompose.c diff -u pecl/translit/data/special_decompose.c:1.2 pecl/translit/data/special_decompose.c:1.3 --- pecl/translit/data/special_decompose.c:1.2 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/special_decompose.c Fri Nov 12 14:37:38 2004 @@ -74,9 +74,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us5 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -108,26 +115,12 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; case 2: /* Expand to more than one char */ for (j = 1; j <= expand_map[cp][0]; j++) { tmp_out[out_idx] = expand_map[cp][j]; out_idx++; } break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; @@ -265,9 +258,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us3 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -310,16 +310,6 @@ out_idx++; } break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; @@ -493,9 +483,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us5 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -538,16 +535,6 @@ out_idx++; } break; - case 3: /* Skip */ - break; - case 4: /* Transpose Up */ - tmp_out[out_idx] = in[i] + transpose_map[cp]; - out_idx++; - break; - case 5: /* Transpose Down */ - tmp_out[out_idx] = in[i] - transpose_map[cp]; - out_idx++; - break; } } *out_length = out_idx; http://cvs.php.net/diff.php/pecl/translit/data/uppercase_cyrillic.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/uppercase_cyrillic.c diff -u pecl/translit/data/uppercase_cyrillic.c:1.4 pecl/translit/data/uppercase_cyrillic.c:1.5 --- pecl/translit/data/uppercase_cyrillic.c:1.4 Thu Nov 11 11:28:20 2004 +++ pecl/translit/data/uppercase_cyrillic.c Fri Nov 12 14:37:38 2004 @@ -98,9 +98,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -133,18 +140,6 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; http://cvs.php.net/diff.php/pecl/translit/data/uppercase_greek.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/uppercase_greek.c diff -u pecl/translit/data/uppercase_greek.c:1.4 pecl/translit/data/uppercase_greek.c:1.5 --- pecl/translit/data/uppercase_greek.c:1.4 Thu Nov 11 11:28:21 2004 +++ pecl/translit/data/uppercase_greek.c Fri Nov 12 14:37:39 2004 @@ -80,9 +80,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -118,14 +125,6 @@ tmp_out[out_idx] = replace_map[cp]; out_idx++; break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++; http://cvs.php.net/diff.php/pecl/translit/data/uppercase_latin.c?r1=1.4&r2=1.5&ty=u Index: pecl/translit/data/uppercase_latin.c diff -u pecl/translit/data/uppercase_latin.c:1.4 pecl/translit/data/uppercase_latin.c:1.5 --- pecl/translit/data/uppercase_latin.c:1.4 Thu Nov 11 11:28:21 2004 +++ pecl/translit/data/uppercase_latin.c Fri Nov 12 14:37:39 2004 @@ -178,9 +178,16 @@ unsigned char *jump_map; unsigned short *replace_map, *transpose_map; us0 *expand_map; - unsigned short *tmp_out; + unsigned short *tmp_out = NULL; unsigned int str_length; + /* Init table pointers */ + jump_map = NULL; + replace_map = NULL; + transpose_map = NULL; + expand_map = NULL; + j = 0; + /* Determine initial string length */ str_length = in_length; tmp_out = (unsigned short *) malloc((str_length * sizeof(unsigned short)) + 8); @@ -215,18 +222,6 @@ tmp_out[out_idx] = in[i]; out_idx++; break; - case 1: /* Simple mapping */ - tmp_out[out_idx] = replace_map[cp]; - out_idx++; - break; - case 2: /* Expand to more than one char */ - for (j = 1; j <= expand_map[cp][0]; j++) { - tmp_out[out_idx] = expand_map[cp][j]; - out_idx++; - } - break; - case 3: /* Skip */ - break; case 4: /* Transpose Up */ tmp_out[out_idx] = in[i] + transpose_map[cp]; out_idx++;
« previous php.pecl.cvs (#2025) next »