cvs: ZendEngine2 / zend_ini.c zend_operators.c zend_operators.h

From: Date: Wed, 19 Mar 2008 12:40:21 +0000
Subject: cvs: ZendEngine2 / zend_ini.c zend_operators.c zend_operators.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6544@lists.php.net to get a copy of this message
tony2001 Wed Mar 19 12:40:21 2008 UTC Modified files: /ZendEngine2 zend_operators.c zend_operators.h zend_ini.c Log: add zend_atol() and use it instead of zend_atoi() where applicable http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.289&r2=1.290&diff_format=u Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.289 ZendEngine2/zend_operators.c:1.290 --- ZendEngine2/zend_operators.c:1.289 Tue Jan 22 09:29:29 2008 +++ ZendEngine2/zend_operators.c Wed Mar 19 12:40:20 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.289 2008/01/22 09:29:29 dmitry Exp $ */ +/* $Id: zend_operators.c,v 1.290 2008/03/19 12:40:20 tony2001 Exp $ */ #include <ctype.h> @@ -75,6 +75,34 @@ } /* }}} */ +ZEND_API long zend_atol(const char *str, int str_len) /* {{{ */ +{ + long retval; + + if (!str_len) { + str_len = strlen(str); + } + retval = strtol(str, NULL, 0); + if (str_len>0) { + switch (str[str_len-1]) { + case 'g': + case 'G': + retval *= 1024; + /* break intentionally missing */ + case 'm': + case 'M': + retval *= 1024; + /* break intentionally missing */ + case 'k': + case 'K': + retval *= 1024; + break; + } + } + return retval; +} +/* }}} */ + ZEND_API double zend_string_to_double(const char *number, zend_uint length) /* {{{ */ { double divisor = 10.0; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.h?r1=1.127&r2=1.128&diff_format=u Index: ZendEngine2/zend_operators.h diff -u ZendEngine2/zend_operators.h:1.127 ZendEngine2/zend_operators.h:1.128 --- ZendEngine2/zend_operators.h:1.127 Thu Feb 14 10:25:10 2008 +++ ZendEngine2/zend_operators.h Wed Mar 19 12:40:20 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.h,v 1.127 2008/02/14 10:25:10 dmitry Exp $ */ +/* $Id: zend_operators.h,v 1.128 2008/03/19 12:40:20 tony2001 Exp $ */ #ifndef ZEND_OPERATORS_H #define ZEND_OPERATORS_H @@ -336,6 +336,7 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC); ZEND_API int zend_atoi(const char *str, int str_len); +ZEND_API int zend_atol(const char *str, int str_len); ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC); END_EXTERN_C() http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_ini.c?r1=1.74&r2=1.75&diff_format=u Index: ZendEngine2/zend_ini.c diff -u ZendEngine2/zend_ini.c:1.74 ZendEngine2/zend_ini.c:1.75 --- ZendEngine2/zend_ini.c:1.74 Thu Mar 13 16:01:46 2008 +++ ZendEngine2/zend_ini.c Wed Mar 19 12:40:20 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.74 2008/03/13 16:01:46 iliaa Exp $ */ +/* $Id: zend_ini.c,v 1.75 2008/03/19 12:40:20 tony2001 Exp $ */ #include "zend.h" #include "zend_qsort.h" @@ -557,7 +557,7 @@ p = (long *) (base+(size_t) mh_arg1); - *p = zend_atoi(new_value, new_value_length); + *p = zend_atol(new_value, new_value_length); return SUCCESS; } /* }}} */ @@ -573,7 +573,7 @@ base = (char *) ts_resource(*((int *) mh_arg2)); #endif - tmp = zend_atoi(new_value, new_value_length); + tmp = zend_atol(new_value, new_value_length); if (tmp < 0) { return FAILURE; }

« previous php.zend-engine.cvs (#6544) next »