A step towards generalizing the INI mechanism even more

This commit is contained in:
Zeev Suraski 1999-04-28 20:26:33 +00:00
parent 1aaf98e54b
commit 66476011dd
8 changed files with 93 additions and 82 deletions

View File

@ -72,7 +72,7 @@ static PHP_INI_MH(OnChangeApacheInt)
long *p;
char *base = (char *) &php_apache_info;
p = (long *) (base+(size_t) mh_arg);
p = (long *) (base+(size_t) mh_arg1);
if (new_value) {
*p = atoi(new_value);
@ -88,7 +88,7 @@ static PHP_INI_MH(OnChangeApacheString)
char **p;
char *base = (char *) &php_apache_info;
p = (char **) (base+(size_t) mh_arg);
p = (char **) (base+(size_t) mh_arg1);
if (new_value) {
*p = new_value;
@ -99,10 +99,10 @@ static PHP_INI_MH(OnChangeApacheString)
}
PHP_INI_BEGIN()
PHP_INI_ENTRY("xbithack", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, xbithack))
PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, engine))
PHP_INI_ENTRY("last_modified", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, last_modified))
PHP_INI_ENTRY("dav_script", NULL, PHP_INI_ALL, OnChangeApacheString, (void *) XtOffsetOf(php_apache_info_struct, dav_script))
PHP_INI_ENTRY1("xbithack", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, xbithack))
PHP_INI_ENTRY1("engine", "1", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, engine))
PHP_INI_ENTRY1("last_modified", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, last_modified))
PHP_INI_ENTRY1("dav_script", NULL, PHP_INI_ALL, OnChangeApacheString, (void *) XtOffsetOf(php_apache_info_struct, dav_script))
PHP_INI_END()

View File

@ -239,7 +239,7 @@ static PHP_INI_MH(OnMySQLInt)
base = (char *) mysql_globals;
#endif
p = (long *) (base+(size_t) mh_arg);
p = (long *) (base+(size_t) mh_arg1);
*p = atoi(new_value);
return SUCCESS;
@ -258,7 +258,7 @@ static PHP_INI_MH(OnMySQLStr)
base = (char *) mysql_globals;
#endif
p = (char **) (base+(size_t) mh_arg);
p = (char **) (base+(size_t) mh_arg1);
*p = new_value;
return SUCCESS;
@ -292,13 +292,13 @@ static PHP_INI_MH(OnMySQLPort)
PHP_INI_BEGIN()
PHP_INI_ENTRY("mysql.allow_persistent", "1", PHP_INI_SYSTEM, OnMySQLInt, (void *) XtOffsetOf(php_mysql_globals, allow_persistent))
PHP_INI_ENTRY("mysql.max_persistent", "-1", PHP_INI_SYSTEM, OnMySQLInt, (void *) XtOffsetOf(php_mysql_globals, max_persistent))
PHP_INI_ENTRY("mysql.max_links", "-1", PHP_INI_SYSTEM, OnMySQLInt, (void *) XtOffsetOf(php_mysql_globals, max_links))
PHP_INI_ENTRY("mysql.default_host", NULL, PHP_INI_ALL, OnMySQLStr, (void *) XtOffsetOf(php_mysql_globals, default_host))
PHP_INI_ENTRY("mysql.default_user", NULL, PHP_INI_ALL, OnMySQLStr, (void *) XtOffsetOf(php_mysql_globals, default_user))
PHP_INI_ENTRY("mysql.default_password", NULL, PHP_INI_ALL, OnMySQLStr, (void *) XtOffsetOf(php_mysql_globals, default_password))
PHP_INI_ENTRY("mysql.default_port", NULL, PHP_INI_ALL, OnMySQLPort, NULL)
PHP_INI_ENTRY1("mysql.allow_persistent", "1", PHP_INI_SYSTEM, OnMySQLInt, (void *) XtOffsetOf(php_mysql_globals, allow_persistent))
PHP_INI_ENTRY1("mysql.max_persistent", "-1", PHP_INI_SYSTEM, OnMySQLInt, (void *) XtOffsetOf(php_mysql_globals, max_persistent))
PHP_INI_ENTRY1("mysql.max_links", "-1", PHP_INI_SYSTEM, OnMySQLInt, (void *) XtOffsetOf(php_mysql_globals, max_links))
PHP_INI_ENTRY1("mysql.default_host", NULL, PHP_INI_ALL, OnMySQLStr, (void *) XtOffsetOf(php_mysql_globals, default_host))
PHP_INI_ENTRY1("mysql.default_user", NULL, PHP_INI_ALL, OnMySQLStr, (void *) XtOffsetOf(php_mysql_globals, default_user))
PHP_INI_ENTRY1("mysql.default_password", NULL, PHP_INI_ALL, OnMySQLStr, (void *) XtOffsetOf(php_mysql_globals, default_password))
PHP_INI_ENTRY1("mysql.default_port", NULL, PHP_INI_ALL, OnMySQLPort, NULL)
PHP_INI_END()

View File

@ -189,7 +189,7 @@ static PHP_INI_MH(odbc_param_int)
long *p;
ODBC_TLS_VARS;
p = (long *) (globals + (size_t)mh_arg);
p = (long *) (globals + (size_t)mh_arg1);
*p = atoi(new_value);
return SUCCESS;
@ -201,7 +201,7 @@ static PHP_INI_MH(odbc_param_str)
char **p;
ODBC_TLS_VARS;
p = (char **) (globals + (size_t)mh_arg);
p = (char **) (globals + (size_t)mh_arg1);
*p = new_value;
return SUCCESS;
@ -209,14 +209,14 @@ static PHP_INI_MH(odbc_param_str)
PHP_INI_BEGIN()
PHP_INI_ENTRY("odbc.allow_persistent", "1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, allow_persistent))
PHP_INI_ENTRY("odbc.max_persistent", "-1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, max_persistent))
PHP_INI_ENTRY("odbc.max_links", "-1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, max_links))
PHP_INI_ENTRY("odbc.default_db", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defDB))
PHP_INI_ENTRY("odbc.default_user", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defUser))
PHP_INI_ENTRY("odbc.default_pw", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defPW))
PHP_INI_ENTRY("odbc.defaultlrl", "4096", PHP_INI_ALL, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, defaultlrl))
PHP_INI_ENTRY("odbc.defaultbinmode", "1", PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defPW))
PHP_INI_ENTRY1("odbc.allow_persistent", "1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, allow_persistent))
PHP_INI_ENTRY1("odbc.max_persistent", "-1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, max_persistent))
PHP_INI_ENTRY1("odbc.max_links", "-1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, max_links))
PHP_INI_ENTRY1("odbc.default_db", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defDB))
PHP_INI_ENTRY1("odbc.default_user", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defUser))
PHP_INI_ENTRY1("odbc.default_pw", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defPW))
PHP_INI_ENTRY1("odbc.defaultlrl", "4096", PHP_INI_ALL, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, defaultlrl))
PHP_INI_ENTRY1("odbc.defaultbinmode", "1", PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defPW))
PHP_INI_END()

View File

@ -213,8 +213,8 @@ static PHP_INI_MH(OnTypelibFileChange)
PHP_INI_BEGIN()
PHP_INI_ENTRY("allow_dcom", "0", PHP_INI_SYSTEM, NULL, NULL)
PHP_INI_ENTRY("typelib_file", NULL, PHP_INI_SYSTEM, OnTypelibFileChange, NULL)
PHP_INI_ENTRY1("allow_dcom", "0", PHP_INI_SYSTEM, NULL, NULL)
PHP_INI_ENTRY1("typelib_file", NULL, PHP_INI_SYSTEM, OnTypelibFileChange, NULL)
PHP_INI_END()

View File

@ -297,8 +297,8 @@ function_entry basic_functions[] = {
PHP_INI_BEGIN()
PHP_INI_ENTRY("highlight.string", "#foobar", PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("test2", "testing", PHP_INI_SYSTEM, NULL, NULL)
PHP_INI_ENTRY1("highlight.string", "#foobar", PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("test2", "testing", PHP_INI_SYSTEM, NULL, NULL)
PHP_INI_END()

View File

@ -187,60 +187,60 @@ static PHP_INI_MH(OnUpdateErrorReporting)
#endif
PHP_INI_BEGIN()
PHP_INI_ENTRY("short_open_tag", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, short_tags))
PHP_INI_ENTRY("asp_tags", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, asp_tags))
PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision, NULL)
PHP_INI_ENTRY1("short_open_tag", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, short_tags))
PHP_INI_ENTRY1("asp_tags", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, asp_tags))
PHP_INI_ENTRY1("precision", "14", PHP_INI_ALL, OnSetPrecision, NULL)
PHP_INI_ENTRY("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_gpc))
PHP_INI_ENTRY("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_runtime))
PHP_INI_ENTRY("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_sybase))
PHP_INI_ENTRY1("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_gpc))
PHP_INI_ENTRY1("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_runtime))
PHP_INI_ENTRY1("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_sybase))
PHP_INI_ENTRY("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, safe_mode))
PHP_INI_ENTRY("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, sql_safe_mode))
PHP_INI_ENTRY("safe_mode_exec_dir", SAFE_MODE_EXEC_DIR, PHP_INI_SYSTEM, OnUpdateString, (void *) XtOffsetOf(php_core_globals, safe_mode_exec_dir))
PHP_INI_ENTRY("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, enable_dl))
PHP_INI_ENTRY1("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, safe_mode))
PHP_INI_ENTRY1("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, sql_safe_mode))
PHP_INI_ENTRY1("safe_mode_exec_dir", SAFE_MODE_EXEC_DIR, PHP_INI_SYSTEM, OnUpdateString, (void *) XtOffsetOf(php_core_globals, safe_mode_exec_dir))
PHP_INI_ENTRY1("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, enable_dl))
PHP_INI_ENTRY("SMTP", "localhost", PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL, NULL)
PHP_INI_ENTRY("sendmail_from", NULL, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("SMTP", "localhost", PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL, NULL)
PHP_INI_ENTRY1("sendmail_from", NULL, PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting, NULL)
PHP_INI_ENTRY("display_errors", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, display_errors))
PHP_INI_ENTRY("track_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_errors))
PHP_INI_ENTRY("log_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, log_errors))
PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, error_log))
PHP_INI_ENTRY1("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting, NULL)
PHP_INI_ENTRY1("display_errors", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, display_errors))
PHP_INI_ENTRY1("track_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_errors))
PHP_INI_ENTRY1("log_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, log_errors))
PHP_INI_ENTRY1("error_log", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, error_log))
PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_prepend_file))
PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_append_file))
PHP_INI_ENTRY1("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_prepend_file))
PHP_INI_ENTRY1("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_append_file))
PHP_INI_ENTRY("y2k_compliance", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, y2k_compliance))
PHP_INI_ENTRY1("y2k_compliance", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, y2k_compliance))
PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, doc_root))
PHP_INI_ENTRY("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, user_dir))
PHP_INI_ENTRY("include_path", NULL, PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, include_path))
PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, open_basedir))
PHP_INI_ENTRY("extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, extension_dir))
PHP_INI_ENTRY1("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, doc_root))
PHP_INI_ENTRY1("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, user_dir))
PHP_INI_ENTRY1("include_path", NULL, PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, include_path))
PHP_INI_ENTRY1("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, open_basedir))
PHP_INI_ENTRY1("extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, extension_dir))
PHP_INI_ENTRY("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, upload_tmp_dir))
PHP_INI_ENTRY("upload_max_filesize", "2097152", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, upload_max_filesize))
PHP_INI_ENTRY1("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, upload_tmp_dir))
PHP_INI_ENTRY1("upload_max_filesize", "2097152", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, upload_max_filesize))
PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL, NULL)
PHP_INI_ENTRY1("browscap", NULL, PHP_INI_SYSTEM, NULL, NULL)
PHP_INI_ENTRY("define_syslog_variables", "0", PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY1("define_syslog_variables", "0", PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnChangeMaxExecutionTime, NULL)
PHP_INI_ENTRY("memory_limit", "8388608", PHP_INI_ALL, OnChangeMemoryLimit, NULL)
PHP_INI_ENTRY1("max_execution_time", "30", PHP_INI_ALL, OnChangeMaxExecutionTime, NULL)
PHP_INI_ENTRY1("memory_limit", "8388608", PHP_INI_ALL, OnChangeMemoryLimit, NULL)
PHP_INI_ENTRY("track_vars", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_vars))
PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, gpc_order))
PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, arg_separator))
PHP_INI_ENTRY1("track_vars", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_vars))
PHP_INI_ENTRY1("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, gpc_order))
PHP_INI_ENTRY1("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, arg_separator))
PHP_INI_END()

View File

@ -106,17 +106,17 @@ int php_register_ini_entries(php_ini_entry *ini_entry, int module_number)
return FAILURE;
}
if (hashed_ini_entry->on_modify) {
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg);
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3);
}
if ((default_value=cfg_get_entry(p->name, p->name_length))) {
if (!hashed_ini_entry->on_modify
|| hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg)==SUCCESS) {
|| hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3)==SUCCESS) {
hashed_ini_entry->value = default_value->value.str.val;
hashed_ini_entry->value_length = default_value->value.str.len;
}
} else {
if (hashed_ini_entry->on_modify) {
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg);
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3);
}
}
hashed_ini_entry->modified = 0;
@ -148,7 +148,7 @@ int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_
duplicate = estrndup(new_value, new_value_length);
if (!ini_entry->on_modify
|| ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg)==SUCCESS) {
|| ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3)==SUCCESS) {
if (!ini_entry->orig_value) {
ini_entry->orig_value = ini_entry->value;
ini_entry->orig_value_length = ini_entry->value_length;
@ -249,7 +249,7 @@ PHP_INI_MH(OnUpdateInt)
base = (char *) core_globals;
#endif
p = (long *) (base+(size_t) mh_arg);
p = (long *) (base+(size_t) mh_arg1);
*p = atoi(new_value);
return SUCCESS;
@ -268,7 +268,7 @@ PHP_INI_MH(OnUpdateReal)
base = (char *) core_globals;
#endif
p = (double *) (base+(size_t) mh_arg);
p = (double *) (base+(size_t) mh_arg1);
*p = strtod(new_value, NULL);
return SUCCESS;
@ -287,7 +287,7 @@ PHP_INI_MH(OnUpdateString)
base = (char *) core_globals;
#endif
p = (char **) (base+(size_t) mh_arg);
p = (char **) (base+(size_t) mh_arg1);
*p = new_value;
return SUCCESS;
@ -310,7 +310,7 @@ PHP_INI_MH(OnUpdateStringUnempty)
return FAILURE;
}
p = (char **) (base+(size_t) mh_arg);
p = (char **) (base+(size_t) mh_arg1);
*p = new_value;
return SUCCESS;

View File

@ -10,7 +10,7 @@
typedef struct _php_ini_entry php_ini_entry;
#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg)
#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3)
struct _php_ini_entry {
int module_number;
@ -18,7 +18,9 @@ struct _php_ini_entry {
char *name;
uint name_length;
PHP_INI_MH((*on_modify));
void *mh_arg;
void *mh_arg1;
void *mh_arg2;
void *mh_arg3;
char *value;
uint value_length;
@ -44,8 +46,17 @@ char *php_ini_string(char *name, uint name_length, int orig);
#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = {
#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify, ptr) \
{ 0, modifyable, name, sizeof(name), on_modify, ptr, default_value, sizeof(default_value)-1, NULL, 0, 0 },
#define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \
{ 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0 },
#define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \
PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
#define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \
PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, NULL, NULL)
#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \
PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, NULL, NULL, NULL)
#define PHP_INI_END() \
{ 0, 0, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, 0 } };