CVS update: php3

From: Date: Tue, 09 Feb 1999 13:28:39 +0000
Subject: CVS update: php3
Groups: php.dev 
Request: Send a blank email to php-dev+get-4005@lists.php.net to get a copy of this message
Date: Tuesday February 9, 1999 @ 8:28 Author: sas Update of /repository/php3 In directory asf:/u/temp/cvs-serv10198 Modified Files: operators.c operators.h Log Message: Implement binary safe strcasecmp Index: php3/operators.c diff -c php3/operators.c:1.98 php3/operators.c:1.99 *** php3/operators.c:1.98 Fri Jan 1 12:58:51 1999 --- php3/operators.c Tue Feb 9 08:28:38 1999 *************** *** 29,35 **** */ ! /* $Id: operators.c,v 1.98 1999/01/01 17:58:51 zeev Exp $ */ #ifdef THREAD_SAFE #include "tls.h" --- 29,35 ---- */ ! /* $Id: operators.c,v 1.99 1999/02/09 13:28:38 sas Exp $ */ #ifdef THREAD_SAFE #include "tls.h" *************** *** 1073,1078 **** --- 1073,1100 ---- } } + + inline int php3_binary_strcasecmp(pval *s1, pval *s2) + { + 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, c2; + int len, len2; + + len = s1->value.str.len; + len2 = s2->value.str.len; + + if (len != len2 && len) + return len - len2; + + while(len--) { + c1 = tolower(*p1++); + c2 = tolower(*p2++); + if (c1 != c2) break; + } + + return c1 - c2; + } inline int php3_binary_strcmp(pval *s1, pval *s2) { Index: php3/operators.h diff -c php3/operators.h:1.36 php3/operators.h:1.37 *** php3/operators.h:1.36 Fri Jan 1 12:58:51 1999 --- php3/operators.h Tue Feb 9 08:28:38 1999 *************** *** 30,36 **** */ ! /* $Id: operators.h,v 1.36 1999/01/01 17:58:51 zeev Exp $ */ #ifndef _OPERATORS_H --- 30,36 ---- */ ! /* $Id: operators.h,v 1.37 1999/02/09 13:28:38 sas Exp $ */ #ifndef _OPERATORS_H *************** *** 84,89 **** --- 84,90 ---- extern int compare_function(pval *result, pval *op1, pval *op2 INLINE_TLS); extern void php3_str_tolower(char *str, unsigned int length); + extern int php3_binary_strcasecmp(pval *s1, pval *s2); extern int php3_binary_strcmp(pval *s1, pval *s2); extern inline void php3_smart_strcmp(pval *result, pval *s1, pval *s2); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4005) next »