Skip to content

Commit 2965c8f

Browse files
committed
Prefer strtoll over atoll
Both are specified by C99, but strtoll has specified overflow behavior while atoll does not, so prefer using it.
1 parent 74b285d commit 2965c8f

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

ext/date/php_date.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i;
5151
int st = snprintf(s, len, "%lld", i); \
5252
s[st] = '\0'; \
5353
} while (0);
54-
#ifdef HAVE_ATOLL
55-
# define DATE_A64I(i, s) i = atoll(s)
56-
#else
57-
# define DATE_A64I(i, s) i = strtoll(s, NULL, 10)
58-
#endif
54+
#define DATE_A64I(i, s) i = strtoll(s, NULL, 10)
5955
#endif
6056

6157
PHPAPI time_t php_time(void)

main/rfc1867.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131
#include "ext/standard/php_string.h"
3232
#include "zend_smart_string.h"
3333

34-
#if defined(PHP_WIN32) && !defined(HAVE_ATOLL)
35-
# define atoll(s) _atoi64(s)
36-
# define HAVE_ATOLL 1
37-
#endif
38-
3934
#ifndef DEBUG_FILE_UPLOAD
4035
# define DEBUG_FILE_UPLOAD 0
4136
#endif
@@ -903,11 +898,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
903898
}
904899

905900
if (!strcasecmp(param, "MAX_FILE_SIZE")) {
906-
#ifdef HAVE_ATOLL
907-
max_file_size = atoll(value);
908-
#else
909901
max_file_size = strtoll(value, NULL, 10);
910-
#endif
911902
}
912903

913904
efree(param);

0 commit comments

Comments
 (0)