unread
2009/8/25 Johannes Schlüter johannes@schlueters.de:
[snip]
For 6 I assume one might remove it, especially as it doesn't know about
IS_UNICODE.
I thought I had enough karma to do it myself.
Can someone make it in trunk then?
Index: ext/standard/math.c
--- ext/standard/math.c (revision 287794)
+++ ext/standard/math.c (working copy)
@@ -795,51 +795,6 @@
}
/* }}} */
-/* {{{ _php_math_basetolong /
-/
-
- Convert a string representation of a base(2-36) number to a long.
- */
-PHPAPI long _php_math_basetolong(zval *arg, int base)
-{ -
long num = 0, digit, onum; -
int i; -
char c, *s; -
if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) { -
return 0; -
} -
s = Z_STRVAL_P(arg); -
for (i = Z_STRLEN_P(arg); i > 0; i--) { -
c = *s++; -
digit = (c >= '0' && c <= '9') ? c - '0' -
: (c >= 'A' && c <= 'Z') ? c - 'A' + 10 -
: (c >= 'a' && c <= 'z') ? c - 'a' + 10 -
: base; -
if (digit >= base) { -
continue; -
} -
onum = num; -
num = num * base + digit; -
if (num > onum) -
continue; -
{ -
TSRMLS_FETCH(); -
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Number '%s' is too big to fit in long", s);
-
return LONG_MAX; -
} -
} -
return num;
-}
-/* }}} */
/* {{{ _php_math_basetozval /
/
- Convert a string representation of a base(2-36) number to a zval.
--
Patrick Allaert
http://code.google.com/p/peclapm/ - Alternative PHP Monitor