static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */
{
- zend_long *p, val;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (zend_long *) (base+(size_t) mh_arg1);
+ zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
- val = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
+ zend_long val = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
if (stage != ZEND_INI_STAGE_STARTUP &&
stage != ZEND_INI_STAGE_SHUTDOWN &&
/* Standard message handlers */
ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */
{
- zend_bool *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (zend_bool *) (base+(size_t) mh_arg1);
-
+ zend_bool *p = (zend_bool *) ZEND_INI_GET_ADDR();
*p = zend_ini_parse_bool(new_value);
return SUCCESS;
}
ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
{
- zend_long *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (zend_long *) (base+(size_t) mh_arg1);
-
+ zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
*p = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
return SUCCESS;
}
ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
{
- zend_long *p, tmp;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- tmp = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
+ zend_long tmp = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
if (tmp < 0) {
return FAILURE;
}
- p = (zend_long *) (base+(size_t) mh_arg1);
+ zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
*p = tmp;
return SUCCESS;
ZEND_API ZEND_INI_MH(OnUpdateReal) /* {{{ */
{
- double *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (double *) (base+(size_t) mh_arg1);
-
+ double *p = (double *) ZEND_INI_GET_ADDR();
*p = zend_strtod(ZSTR_VAL(new_value), NULL);
return SUCCESS;
}
ZEND_API ZEND_INI_MH(OnUpdateString) /* {{{ */
{
- char **p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (char **) (base+(size_t) mh_arg1);
-
+ char **p = (char **) ZEND_INI_GET_ADDR();
*p = new_value ? ZSTR_VAL(new_value) : NULL;
return SUCCESS;
}
ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) /* {{{ */
{
- char **p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
if (new_value && !ZSTR_VAL(new_value)[0]) {
return FAILURE;
}
- p = (char **) (base+(size_t) mh_arg1);
-
+ char **p = (char **) ZEND_INI_GET_ADDR();
*p = new_value ? ZSTR_VAL(new_value) : NULL;
return SUCCESS;
}
void *arg;
} zend_ini_parser_param;
+#ifndef ZTS
+# define ZEND_INI_GET_BASE() ((char *) mh_arg2)
+#else
+# define ZEND_INI_GET_BASE() ((char *) ts_resource(*((int *) mh_arg2)))
+#endif
+
+#define ZEND_INI_GET_ADDR() (ZEND_INI_GET_BASE() + (size_t) mh_arg1)
+
#endif /* ZEND_INI_H */
static ZEND_INI_MH(OnUpdateMemoryConsumption)
{
- zend_long *p;
- zend_long memsize;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- /* keep the compiler happy */
- (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
-
- p = (zend_long *) (base + (size_t)mh_arg1);
- memsize = atoi(ZSTR_VAL(new_value));
+ zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
+ zend_long memsize = atoi(ZSTR_VAL(new_value));
/* sanity check we must use at least 8 MB */
if (memsize < 8) {
const char *new_new_value = "8";
static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
{
- zend_long *p;
- zend_long size;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- /* keep the compiler happy */
- (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
-
- p = (zend_long *) (base + (size_t)mh_arg1);
- size = atoi(ZSTR_VAL(new_value));
+ zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
+ zend_long size = atoi(ZSTR_VAL(new_value));
/* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */
if (size < MIN_ACCEL_FILES || size > MAX_ACCEL_FILES) {
static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
{
- double *p;
- zend_long percentage;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- /* keep the compiler happy */
- (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
-
- p = (double *) (base + (size_t)mh_arg1);
- percentage = atoi(ZSTR_VAL(new_value));
+ double *p = (double *) ZEND_INI_GET_ADDR();
+ zend_long percentage = atoi(ZSTR_VAL(new_value));
if (percentage <= 0 || percentage > 50) {
const char *new_new_value = "5";
return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
} else {
/* It may be only temporary disabled */
- zend_bool *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (zend_bool *) (base+(size_t) mh_arg1);
+ zend_bool *p = (zend_bool *) ZEND_INI_GET_ADDR();
if ((ZSTR_LEN(new_value) == 2 && strcasecmp("on", ZSTR_VAL(new_value)) == 0) ||
(ZSTR_LEN(new_value) == 3 && strcasecmp("yes", ZSTR_VAL(new_value)) == 0) ||
(ZSTR_LEN(new_value) == 4 && strcasecmp("true", ZSTR_VAL(new_value)) == 0) ||
ZEND_INI_MH(OnUpdateCacheMode)
{
- char *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (char*) (base+(size_t) mh_arg1);
-
+ char *p = (char *) ZEND_INI_GET_ADDR();
*p = (char)atoi(ZSTR_VAL(new_value));
-
return SUCCESS;
}
{
int int_value;
char *ini_value;
- zend_long *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
if (new_value == NULL) {
return FAILURE;
}
}
}
- p = (zend_long *) (base+(size_t) mh_arg1);
+ zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
*p = int_value;
ZLIBG(output_compression) = ZLIBG(output_compression_default);
or a tightening during activation/runtime/deactivation */
PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
{
- char **p, *pathbuf, *ptr, *end;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (char **) (base + (size_t) mh_arg1);
+ char **p = (char **) ZEND_INI_GET_ADDR();
+ char *pathbuf, *ptr, *end;
if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN || stage == PHP_INI_STAGE_ACTIVATE || stage == PHP_INI_STAGE_DEACTIVATE) {
/* We're in a PHP_INI_SYSTEM context, no restrictions */