cvs: /php3 operators.c
| From: | Andrew Skalski | Date: | Mon, 20 Mar 2000 16:38:06 +0000 |
| Subject: | cvs: /php3 operators.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17095@lists.php.net to get a copy of this message | ||
askalski Mon Mar 20 08:38:06 2000 EDT
Modified files:
/php3 operators.c
Log:
fixed php3_binary_strcasecmp. it erroneously compared size before content.
Index: php3/operators.c
diff -u php3/operators.c:1.105 php3/operators.c:1.106
--- php3/operators.c:1.105 Mon Feb 7 15:54:50 2000
+++ php3/operators.c Mon Mar 20 08:38:06 2000
@@ -29,7 +29,7 @@
*/
-/* $Id: operators.c,v 1.105 2000/02/07 23:54:50 zeev Exp $ */
+/* $Id: operators.c,v 1.106 2000/03/20 16:38:06 askalski Exp $ */
#include "php.h"
#include "functions/number.h"
@@ -1077,21 +1077,18 @@
const unsigned char *p1 = (const unsigned char *) s1->value.str.val;
const unsigned char *p2 = (const unsigned char *) s2->value.str.val;
unsigned char c1=0, c2=0;
- int len, len2;
-
- len = s1->value.str.len;
- len2 = s2->value.str.len;
-
- if (len != len2 || !len)
- return len - len2;
+ int len;
+ len = MIN(s1->value.str.len, s2->value.str.len);
while(len--) {
c1 = tolower(*p1++);
c2 = tolower(*p2++);
- if (c1 != c2) break;
+ if (c1 != c2) {
+ return c1 - c2;
+ }
}
-
- return c1 - c2;
+
+ return s1->value.str.len - s2->value.str.len;
}
inline int php3_binary_strcmp(pval *s1, pval *s2)