moriyoshi Wed Dec 10 01:08:40 2003 EDT Modified files: /php-src/ext/standard php_string.h file.c Log: Expose the macro globally Index: php-src/ext/standard/php_string.h diff -u php-src/ext/standard/php_string.h:1.80 php-src/ext/standard/php_string.h:1.81 --- php-src/ext/standard/php_string.h:1.80 Wed Oct 29 19:49:33 2003 +++ php-src/ext/standard/php_string.h Wed Dec 10 01:08:39 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_string.h,v 1.80 2003/10/30 00:49:33 iliaa Exp $ */ +/* $Id: php_string.h,v 1.81 2003/12/10 06:08:39 moriyoshi Exp $ */ /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */ @@ -144,6 +144,16 @@ #define strerror php_strerror #endif +#ifndef HAVE_MBLEN +# define php_mblen(ptr, len) 1 +#else +# if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T) +# define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state))) +# else +# define php_mblen(ptr, len) mblen(ptr, len) +# endif +#endif + void register_string_constants(INIT_FUNC_ARGS); #endif /* PHP_STRING_H */ Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.367 php-src/ext/standard/file.c:1.368 --- php-src/ext/standard/file.c:1.367 Sat Nov 29 16:46:47 2003 +++ php-src/ext/standard/file.c Wed Dec 10 01:08:39 2003 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.367 2003/11/29 21:46:47 wez Exp $ */ +/* $Id: file.c,v 1.368 2003/12/10 06:08:39 moriyoshi Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1718,28 +1718,18 @@ } /* }}} */ -#ifndef HAVE_MBLEN -# define _php_mblen(ptr, len) 1 -#else -# if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T) -# define _php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state))) -# else -# define _php_mblen(ptr, len) mblen(ptr, len) -# endif -#endif - static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t len, const char delimiter TSRMLS_DC) { int inc_len; unsigned char last_chars[2] = { 0, 0 }; while (len > 0) { - inc_len = (*ptr == '\0' ? 1: _php_mblen(ptr, len)); + inc_len = (*ptr == '\0' ? 1: php_mblen(ptr, len)); switch (inc_len) { case -2: case -1: inc_len = 1; - _php_mblen(NULL, 0); + php_mblen(NULL, 0); break; case 0: goto quit_loop; @@ -1839,7 +1829,7 @@ } } /* initialize internal state */ - _php_mblen(NULL, 0); + php_mblen(NULL, 0); /* Now into new section that parses buf for delimiter/enclosure fields */ @@ -1868,12 +1858,12 @@ /* 1. Strip any leading space */ for (;;) { - inc_len = (bptr < limit ? (*bptr == '\0' ? 1: _php_mblen(bptr, limit - bptr)): 0); + inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); switch (inc_len) { case -2: case -1: inc_len = 1; - _php_mblen(NULL, 0); + php_mblen(NULL, 0); break; case 0: goto quit_loop_0; @@ -1897,7 +1887,7 @@ /* 2A. handle enclosure delimited field */ for (;;) { - inc_len = (bptr < limit ? (*bptr == '\0' ? 1: _php_mblen(bptr, limit - bptr)): 0); + inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); switch (inc_len) { case 0: switch (state) { @@ -1958,7 +1948,7 @@ case -2: case -1: - _php_mblen(NULL, 0); + php_mblen(NULL, 0); /* break is omitted intentionally */ case 1: /* we need to determine if the enclosure is @@ -2021,7 +2011,7 @@ case -2: case -1: inc_len = 1; - _php_mblen(NULL, 0); + php_mblen(NULL, 0); /* break is omitted intentionally */ case 1: if (*bptr == delimiter) { @@ -2032,7 +2022,7 @@ break; } bptr += inc_len; - inc_len = (bptr < limit ? (*bptr == '\0' ? 1: _php_mblen(bptr, limit - bptr)): 0); + inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); } quit_loop_3: comp_end = tptr; @@ -2046,14 +2036,14 @@ hunk_begin = bptr; for (;;) { - inc_len = (bptr < limit ? (*bptr == '\0' ? 1: _php_mblen(bptr, limit - bptr)): 0); + inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); switch (inc_len) { case 0: goto quit_loop_4; case -2: case -1: inc_len = 1; - _php_mblen(NULL, 0); + php_mblen(NULL, 0); /* break is omitted intentionally */ case 1: if (*bptr == delimiter) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php