mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Return value from ZEND_ATOL
Instead of assigning it as part of the macro itself, which makes usage quite awkward.
This commit is contained in:
@@ -163,9 +163,7 @@ static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */
|
||||
|
||||
static ZEND_INI_MH(OnSetExceptionStringParamMaxLen) /* {{{ */
|
||||
{
|
||||
zend_long i;
|
||||
|
||||
ZEND_ATOL(i, ZSTR_VAL(new_value));
|
||||
zend_long i = ZEND_ATOL(ZSTR_VAL(new_value));
|
||||
if (i >= 0 && i <= 1000000) {
|
||||
EG(exception_string_param_max_len) = i;
|
||||
return SUCCESS;
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef int32_t zend_off_t;
|
||||
# define ZEND_ULONG_FMT_SPEC PRIu64
|
||||
# ifdef ZEND_WIN32
|
||||
# define ZEND_LTOA(i, s, len) _i64toa_s((i), (s), (len), 10)
|
||||
# define ZEND_ATOL(i, s) i = _atoi64((s))
|
||||
# define ZEND_ATOL(s) _atoi64((s))
|
||||
# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base))
|
||||
# define ZEND_STRTOUL(s0, s1, base) _strtoui64((s0), (s1), (base))
|
||||
# define ZEND_STRTOL_PTR _strtoi64
|
||||
@@ -73,7 +73,7 @@ typedef int32_t zend_off_t;
|
||||
int st = snprintf((s), (len), ZEND_LONG_FMT, (i)); \
|
||||
(s)[st] = '\0'; \
|
||||
} while (0)
|
||||
# define ZEND_ATOL(i, s) (i) = atoll((s))
|
||||
# define ZEND_ATOL(s) atoll((s))
|
||||
# define ZEND_STRTOL(s0, s1, base) strtoll((s0), (s1), (base))
|
||||
# define ZEND_STRTOUL(s0, s1, base) strtoull((s0), (s1), (base))
|
||||
# define ZEND_STRTOL_PTR strtoll
|
||||
@@ -90,14 +90,14 @@ typedef int32_t zend_off_t;
|
||||
# define ZEND_ULONG_FMT_SPEC PRIu32
|
||||
# ifdef ZEND_WIN32
|
||||
# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10)
|
||||
# define ZEND_ATOL(i, s) i = atol((s))
|
||||
# define ZEND_ATOL(s) atol((s))
|
||||
# else
|
||||
# define ZEND_LTOA(i, s, len) \
|
||||
do { \
|
||||
int st = snprintf((s), (len), ZEND_LONG_FMT, (i)); \
|
||||
(s)[st] = '\0'; \
|
||||
} while (0)
|
||||
# define ZEND_ATOL(i, s) (i) = atol((s))
|
||||
# define ZEND_ATOL(s) atol((s))
|
||||
# endif
|
||||
# define ZEND_STRTOL_PTR strtol
|
||||
# define ZEND_STRTOUL_PTR strtoul
|
||||
|
||||
@@ -1108,8 +1108,6 @@ bail:
|
||||
zend_long
|
||||
ftp_size(ftpbuf_t *ftp, const char *path, const size_t path_len)
|
||||
{
|
||||
zend_long res;
|
||||
|
||||
if (ftp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@@ -1122,8 +1120,7 @@ ftp_size(ftpbuf_t *ftp, const char *path, const size_t path_len)
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 213) {
|
||||
return -1;
|
||||
}
|
||||
ZEND_ATOL(res, ftp->inbuf);
|
||||
return res;
|
||||
return ZEND_ATOL(ftp->inbuf);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -157,9 +157,7 @@ static PHP_GINIT_FUNCTION(mysqlnd)
|
||||
/* {{{ PHP_INI_MH */
|
||||
static PHP_INI_MH(OnUpdateNetCmdBufferSize)
|
||||
{
|
||||
zend_long long_value;
|
||||
|
||||
ZEND_ATOL(long_value, ZSTR_VAL(new_value));
|
||||
zend_long long_value = ZEND_ATOL(ZSTR_VAL(new_value));
|
||||
if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const zend_string *sql)
|
||||
}
|
||||
H->pgoid = PQoidValue(res);
|
||||
if (qs == PGRES_COMMAND_OK) {
|
||||
ZEND_ATOL(ret, PQcmdTuples(res));
|
||||
ret = ZEND_ATOL(PQcmdTuples(res));
|
||||
} else {
|
||||
ret = Z_L(0);
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ stmt_retry:
|
||||
}
|
||||
|
||||
if (status == PGRES_COMMAND_OK) {
|
||||
ZEND_ATOL(stmt->row_count, PQcmdTuples(S->result));
|
||||
stmt->row_count = ZEND_ATOL(PQcmdTuples(S->result));
|
||||
H->pgoid = PQoidValue(S->result);
|
||||
} else {
|
||||
stmt->row_count = (zend_long)PQntuples(S->result);
|
||||
@@ -272,14 +272,14 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
|
||||
/* decode name from $1, $2 into 0, 1 etc. */
|
||||
if (param->name) {
|
||||
if (ZSTR_VAL(param->name)[0] == '$') {
|
||||
ZEND_ATOL(param->paramno, ZSTR_VAL(param->name) + 1);
|
||||
param->paramno = ZEND_ATOL(ZSTR_VAL(param->name) + 1);
|
||||
} else {
|
||||
/* resolve parameter name to rewritten name */
|
||||
zend_string *namevar;
|
||||
|
||||
if (stmt->bound_param_map && (namevar = zend_hash_find_ptr(stmt->bound_param_map,
|
||||
param->name)) != NULL) {
|
||||
ZEND_ATOL(param->paramno, ZSTR_VAL(namevar) + 1);
|
||||
param->paramno = ZEND_ATOL(ZSTR_VAL(namevar) + 1);
|
||||
param->paramno--;
|
||||
} else {
|
||||
pdo_pgsql_error_stmt_msg(stmt, 0, "HY093", ZSTR_VAL(param->name));
|
||||
@@ -505,12 +505,8 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, zval *result, enum pd
|
||||
#if SIZEOF_ZEND_LONG >= 8
|
||||
case INT8OID:
|
||||
#endif
|
||||
{
|
||||
zend_long intval;
|
||||
ZEND_ATOL(intval, ptr);
|
||||
ZVAL_LONG(result, intval);
|
||||
ZVAL_LONG(result, ZEND_ATOL(ptr));
|
||||
break;
|
||||
}
|
||||
|
||||
case OIDOID: {
|
||||
char *end_ptr;
|
||||
|
||||
@@ -511,11 +511,8 @@ int fcgi_init(void)
|
||||
|
||||
str = getenv("_FCGI_SHUTDOWN_EVENT_");
|
||||
if (str != NULL) {
|
||||
zend_long ev;
|
||||
HANDLE shutdown_event;
|
||||
|
||||
ZEND_ATOL(ev, str);
|
||||
shutdown_event = (HANDLE) ev;
|
||||
zend_long ev = ZEND_ATOL(str);
|
||||
HANDLE shutdown_event = (HANDLE) ev;
|
||||
if (!CreateThread(NULL, 0, fcgi_shutdown_thread,
|
||||
shutdown_event, 0, NULL)) {
|
||||
return -1;
|
||||
@@ -523,9 +520,7 @@ int fcgi_init(void)
|
||||
}
|
||||
str = getenv("_FCGI_MUTEX_");
|
||||
if (str != NULL) {
|
||||
zend_long mt;
|
||||
ZEND_ATOL(mt, str);
|
||||
fcgi_accept_mutex = (HANDLE) mt;
|
||||
fcgi_accept_mutex = (HANDLE) ZEND_ATOL(str);
|
||||
}
|
||||
return is_fastcgi = 1;
|
||||
} else {
|
||||
|
||||
16
main/main.c
16
main/main.c
@@ -236,9 +236,7 @@ static PHP_INI_MH(OnSetFacility)
|
||||
/* {{{ PHP_INI_MH */
|
||||
static PHP_INI_MH(OnSetPrecision)
|
||||
{
|
||||
zend_long i;
|
||||
|
||||
ZEND_ATOL(i, ZSTR_VAL(new_value));
|
||||
zend_long i = ZEND_ATOL(ZSTR_VAL(new_value));
|
||||
if (i >= -1) {
|
||||
EG(precision) = i;
|
||||
return SUCCESS;
|
||||
@@ -251,9 +249,7 @@ static PHP_INI_MH(OnSetPrecision)
|
||||
/* {{{ PHP_INI_MH */
|
||||
static PHP_INI_MH(OnSetSerializePrecision)
|
||||
{
|
||||
zend_long i;
|
||||
|
||||
ZEND_ATOL(i, ZSTR_VAL(new_value));
|
||||
zend_long i = ZEND_ATOL(ZSTR_VAL(new_value));
|
||||
if (i >= -1) {
|
||||
PG(serialize_precision) = i;
|
||||
return SUCCESS;
|
||||
@@ -402,11 +398,11 @@ static PHP_INI_MH(OnUpdateTimeout)
|
||||
{
|
||||
if (stage==PHP_INI_STAGE_STARTUP) {
|
||||
/* Don't set a timeout on startup, only per-request */
|
||||
ZEND_ATOL(EG(timeout_seconds), ZSTR_VAL(new_value));
|
||||
EG(timeout_seconds) = ZEND_ATOL(ZSTR_VAL(new_value));
|
||||
return SUCCESS;
|
||||
}
|
||||
zend_unset_timeout();
|
||||
ZEND_ATOL(EG(timeout_seconds), ZSTR_VAL(new_value));
|
||||
EG(timeout_seconds) = ZEND_ATOL(ZSTR_VAL(new_value));
|
||||
if (stage != PHP_INI_STAGE_DEACTIVATE) {
|
||||
/*
|
||||
* If we're restoring INI values, we shouldn't reset the timer.
|
||||
@@ -423,8 +419,6 @@ static PHP_INI_MH(OnUpdateTimeout)
|
||||
/* {{{ php_get_display_errors_mode() helper function */
|
||||
static zend_uchar php_get_display_errors_mode(zend_string *value)
|
||||
{
|
||||
zend_uchar mode;
|
||||
|
||||
if (!value) {
|
||||
return PHP_DISPLAY_ERRORS_STDOUT;
|
||||
}
|
||||
@@ -446,7 +440,7 @@ static zend_uchar php_get_display_errors_mode(zend_string *value)
|
||||
return PHP_DISPLAY_ERRORS_STDOUT;
|
||||
}
|
||||
|
||||
ZEND_ATOL(mode, ZSTR_VAL(value));
|
||||
zend_uchar mode = ZEND_ATOL(ZSTR_VAL(value));
|
||||
if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) {
|
||||
return PHP_DISPLAY_ERRORS_STDOUT;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx)
|
||||
|
||||
content_length = (char *) apr_table_get(r->headers_in, "Content-Length");
|
||||
if (content_length) {
|
||||
ZEND_ATOL(SG(request_info).content_length, content_length);
|
||||
SG(request_info).content_length = ZEND_ATOL(content_length);
|
||||
} else {
|
||||
SG(request_info).content_length = 0;
|
||||
}
|
||||
|
||||
@@ -2382,7 +2382,7 @@ static void php_cli_server_startup_workers() {
|
||||
}
|
||||
|
||||
#if HAVE_FORK
|
||||
ZEND_ATOL(php_cli_server_workers_max, workers);
|
||||
php_cli_server_workers_max = ZEND_ATOL(workers);
|
||||
if (php_cli_server_workers_max > 1) {
|
||||
zend_long php_cli_server_worker;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user