8000 Remove incorrect uses of zend_atoi() · nikic/php-src@989205e · GitHub
[go: up one dir, main page]

Skip to content

Commit 989205e

Browse files
committed
Remove incorrect uses of zend_atoi()
zend_atoi() parses integers with size suffixes (like "128M"). These just want to use a plain number, so use ZEND_ATOL instead.
1 parent efbb219 commit 989205e

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

Zend/zend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ void zend_startup(zend_utility_functions *utility_functions) /* {{{ */
896896
{
897897
char *tmp = getenv("USE_ZEND_DTRACE");
898898

899-
if (tmp && zend_atoi(tmp, 0)) {
899+
if (tmp && ZEND_ATOL(tmp)) {
900900
zend_dtrace_enabled = 1;
901901
zend_compile_file = dtrace_compile_file;
902902
zend_execute_ex = dtrace_execute_ex;

Zend/zend_alloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,8 +2801,8 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
28012801

28022802
#if ZEND_MM_CUSTOM
28032803
tmp = getenv("USE_ZEND_ALLOC");
2804-
if (tmp && !zend_atoi(tmp, 0)) {
2805-
bool tracked = (tmp = getenv("USE_TRACKED_ALLOC")) && zend_atoi(tmp, 0);
2804+
if (tmp && ZEND_ATOL(tmp)) {
2805+
bool tracked = (tmp = getenv("USE_TRACKED_ALLOC")) && ZEND_ATOL(tmp);
28062806
zend_mm_heap *mm_heap = alloc_globals->mm_heap = malloc(sizeof(zend_mm_heap));
28072807
memset(mm_heap, 0, sizeof(zend_mm_heap));
28082808
mm_heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_STD;
@@ -2827,7 +2827,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
28272827
#endif
28282828

28292829
tmp = getenv("USE_ZEND_ALLOC_HUGE_PAGES");
2830-
if (tmp && zend_atoi(tmp, 0)) {
2830+
if (tmp && ZEND_ATOL(tmp)) {
28312831
zend_mm_use_huge_pages = 1;
28322832
}
28332833
alloc_global DCEC s->mm_heap = zend_mm_init();

ext/session/session.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,7 @@ static PHP_INI_MH(OnUpdateLazyWrite) /* {{{ */
769769

770770
static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
771771
{
772-
int tmp;
773-
tmp = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
772+
int tmp = ZEND_ATOL(ZSTR_VAL(new_value));
774773
if(tmp < 0) {
775774
php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to 0");
776775
return FAILURE;

sapi/cli/php_cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ int main(int argc, char *argv[])
11961196
#if defined(PHP_WIN32) && defined(_DEBUG)
11971197
{
11981198
char *tmp = getenv("PHP_WIN32_DEBUG_HEAP");
1199-
if (tmp && zend_atoi(tmp, 0)) {
1199+
if (tmp && ZEND_ATOL(tmp, 0)) {
12001200
int tmp_flag;
12011201
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
12021202
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);

0 commit comments

Comments
 (0)
0