]> granicus.if.org Git - php/commitdiff
Make calc_levdist static and fix pointer swapping.
authorSascha Schumann <sas@php.net>
Tue, 23 May 2000 19:27:02 +0000 (19:27 +0000)
committerSascha Schumann <sas@php.net>
Tue, 23 May 2000 19:27:02 +0000 (19:27 +0000)
ext/standard/levenshtein.c

index a702d3cfea7f67e636d715613e136b3a089f3408..4227cf05f4ef768381a85f0376000d2f9a902177 100644 (file)
@@ -23,7 +23,7 @@
 #include <ctype.h>
 #include "php_string.h"
 
-int calc_levdist(const char *s1, const char *s2) /* faster, but obfuscated */
+static int calc_levdist(const char *s1, const char *s2) /* faster, but obfuscated */
 {
        register char *p1,*p2;
        register int i,j,n;
@@ -60,8 +60,16 @@ int calc_levdist(const char *s1, const char *s2) /* faster, but obfuscated */
 
        /* swap if l2 longer than l1 */
        if(l1<l2) {
-               (long)s1 ^= (long)s2; (long)s2 ^= (long)s1; (long)s1 ^= (long)s2;
-               l1 ^= l2; l2 ^= l1; l1 ^= l2;
+               const char *s3;
+               int l3;
+               
+               s3 = s1;
+               s1 = s2;
+               s2 = s3;
+
+               l3 = l1;
+               l1 = l2;
+               l2 = l3;
        }