The pass-by-reference on the string on fastCompose() really slows things down sometim...
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 30 Oct 2004 12:35:37 +0000 (12:35 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 30 Oct 2004 12:35:37 +0000 (12:35 +0000)
includes/normal/UtfNormal.php

index b1664fa..5e31294 100644 (file)
@@ -417,11 +417,11 @@ class UtfNormal {
         * (depending on which decomposition map is passed to us).
         * Input is assumed to be *valid* UTF-8. Invalid code will break.
         * @access private
-        * @param string &$string Valid UTF-8 string
-        * @param array &$map hash of expanded decomposition map
+        * @param string $string Valid UTF-8 string
+        * @param array $map hash of expanded decomposition map
         * @return string a UTF-8 string decomposed, not yet normalized (needs sorting)
         */
-       function fastDecompose( &$string, &$map ) {
+       function fastDecompose( $string, &$map ) {
                UtfNormal::loadData();
                $len = strlen( $string );
                $out = '';
@@ -445,6 +445,7 @@ class UtfNormal {
                        }
                        if( isset( $map[$c] ) ) {
                                $out .= $map[$c];
+                               continue;
                        } else {
                                if( $c >= UTF8_HANGUL_FIRST && $c <= UTF8_HANGUL_LAST ) {
                                        # Decompose a hangul syllable into jamo;
@@ -465,10 +466,10 @@ class UtfNormal {
                                        } elseif( $t ) {
                                                $out .= "\xe1\x86" . chr( 0xa7 + $t );
                                        }
-                               } else {
-                                       $out .= $c;
+                                       continue;
                                }
                        }
+                       $out .= $c;
                }
                return $out;
        }