rolland Tue Aug 16 02:02:57 2005 EDT
Modified files:
/php-src/ext/standard php_string.h string.c
Log:
php_trim() takes extra arg to determine string type to be returned
http://cvs.php.net/diff.php/php-src/ext/standard/php_string.h?r1=1.88&r2=1.89&ty=u
Index: php-src/ext/standard/php_string.h
diff -u php-src/ext/standard/php_string.h:1.88
php-src/ext/standard/php_string.h:1.89
--- php-src/ext/standard/php_string.h:1.88 Thu Aug 11 19:35:59 2005
+++ php-src/ext/standard/php_string.h Tue Aug 16 02:02:55 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_string.h,v 1.88 2005/08/11 23:35:59 andrei Exp $ */
+/* $Id: php_string.h,v 1.89 2005/08/16 06:02:55 rolland Exp $ */
/* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
@@ -132,7 +132,7 @@
int needle_len, char *str, int str_len, int *_new_length, int
case_sensitivity, int *replace_count);
PHPAPI char *php_str_to_str(char *haystack, int length, char *needle,
int needle_len, char *str, int str_len, int *_new_length);
-PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval
*return_value, int mode TSRMLS_DC);
+PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zend_uchar
str_type, zval *return_value, int mode TSRMLS_DC);
PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int
allow_len);
PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int
to_len, pval *result, int case_sensitivity, int *replace_count);
PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int
to_len, pval *result);
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.453&r2=1.454&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.453 php-src/ext/standard/string.c:1.454
--- php-src/ext/standard/string.c:1.453 Mon Aug 15 15:12:59 2005
+++ php-src/ext/standard/string.c Tue Aug 16 02:02:56 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.453 2005/08/15 19:12:59 johannes Exp $ */
+/* $Id: string.c,v 1.454 2005/08/16 06:02:56 rolland Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -538,7 +538,7 @@
* mode 3 : trim left and right
* what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0')
*/
-PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval
*return_value, int mode TSRMLS_DC)
+PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zend_uchar
str_type, zval *return_value, int mode TSRMLS_DC)
{
register int i;
int trimmed = 0;
@@ -572,7 +572,11 @@
}
if (return_value) {
- RETVAL_STRINGL(c, len, 1);
+ if ( str_type == IS_BINARY ) {
+ RETVAL_BINARYL(c, len, 1);
+ } else {
+ RETVAL_STRINGL(c, len, 1);
+ }
} else {
return estrndup(c, len);
}
@@ -750,13 +754,13 @@
if ( str_type == IS_UNICODE ) {
php_u_trim(str, str_len, what, what_len, return_value,
mode TSRMLS_CC);
} else {
- php_trim(str, str_len, what, what_len, return_value,
mode TSRMLS_CC);
+ php_trim(str, str_len, what, what_len, str_type,
return_value, mode TSRMLS_CC);
}
} else {
if ( str_type == IS_UNICODE ) {
php_u_trim(str, str_len, NULL, 0, return_value, mode
TSRMLS_CC);
} else {
- php_trim(str, str_len, NULL, 0, return_value, mode
TSRMLS_CC);
+ php_trim(str, str_len, NULL, 0, str_type, return_value,
mode TSRMLS_CC);
}
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php