cvs: ZendEngine2(PHP_5_3) / zend_ini.c zend_operators.c zend_operators.h

[email protected] ("Antony Dovgal")
Newsgroups php.zend-engine.cvs
Message-ID <cvstony20011205930483@cvsserver>
tony2001		Wed Mar 19 12:41:23 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /ZendEngine2	zend_operators.c zend_operators.h zend_ini.c 
  Log:
  MFH: add zend_atol()
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.208.2.4.2.23.2.9&r2=1.208.2.4.2.23.2.10&diff_format=u
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.9 ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.10
--- ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.9	Tue Mar 18 14:10:43 2008
+++ ZendEngine2/zend_operators.c	Wed Mar 19 12:41:23 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.9 2008/03/18 14:10:43 felipe Exp $ */
+/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.10 2008/03/19 12:41:23 tony2001 Exp $ */
 
 #include <ctype.h>
 
@@ -71,6 +71,33 @@
 	return retval;
 }
 
+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)
 {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.h?r1=1.94.2.4.2.10.2.5&r2=1.94.2.4.2.10.2.6&diff_format=u
Index: ZendEngine2/zend_operators.h
diff -u ZendEngine2/zend_operators.h:1.94.2.4.2.10.2.5 ZendEngine2/zend_operators.h:1.94.2.4.2.10.2.6
--- ZendEngine2/zend_operators.h:1.94.2.4.2.10.2.5	Thu Feb 14 10:25:22 2008
+++ ZendEngine2/zend_operators.h	Wed Mar 19 12:41:23 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_operators.h,v 1.94.2.4.2.10.2.5 2008/02/14 10:25:22 dmitry Exp $ */
+/* $Id: zend_operators.h,v 1.94.2.4.2.10.2.6 2008/03/19 12:41:23 tony2001 Exp $ */
 
 #ifndef ZEND_OPERATORS_H
 #define ZEND_OPERATORS_H
@@ -312,6 +312,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.39.2.2.2.18.2.13&r2=1.39.2.2.2.18.2.14&diff_format=u
Index: ZendEngine2/zend_ini.c
diff -u ZendEngine2/zend_ini.c:1.39.2.2.2.18.2.13 ZendEngine2/zend_ini.c:1.39.2.2.2.18.2.14
--- ZendEngine2/zend_ini.c:1.39.2.2.2.18.2.13	Thu Mar 13 16:01:31 2008
+++ ZendEngine2/zend_ini.c	Wed Mar 19 12:41:23 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_ini.c,v 1.39.2.2.2.18.2.13 2008/03/13 16:01:31 iliaa Exp $ */
+/* $Id: zend_ini.c,v 1.39.2.2.2.18.2.14 2008/03/19 12:41:23 tony2001 Exp $ */
 
 #include "zend.h"
 #include "zend_qsort.h"
@@ -556,7 +556,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;
 }
 /* }}} */
@@ -572,7 +572,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;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.