[PHP4BETA] CVS update: php4

From: Date: Wed, 28 Apr 1999 20:26:29 +0000
Subject: [PHP4BETA] CVS update: php4
Groups: php.version4 
Request: Send a blank email to php-version4+get-575@lists.php.net to get a copy of this message
Date: Wednesday April 28, 1999 @ 16:26 Author: zeev Update of /repository/php4 In directory php:/tmp/cvs-serv32082 Modified Files: main.c php_ini.c php_ini.h Log Message: A step towards generalizing the INI mechanism even more Index: php4/main.c diff -u php4/main.c:1.38 php4/main.c:1.39 --- php4/main.c:1.38 Wed Apr 28 13:38:24 1999 +++ php4/main.c Wed Apr 28 16:26:29 1999 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.38 1999/04/28 17:38:24 andi Exp $ */ +/* $Id: main.c,v 1.39 1999/04/28 20:26:29 zeev Exp $ */ #include <stdio.h> @@ -187,60 +187,60 @@ #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_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_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_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_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_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_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_ENTRY("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_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_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL, NULL) - - PHP_INI_ENTRY("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_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("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_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_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_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_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_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_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_ENTRY1("y2k_compliance", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, y2k_compliance)) + + 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_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_ENTRY1("browscap", NULL, PHP_INI_SYSTEM, NULL, NULL) + + PHP_INI_ENTRY1("define_syslog_variables", "0", PHP_INI_ALL, NULL, 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_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() Index: php4/php_ini.c diff -u php4/php_ini.c:1.12 php4/php_ini.c:1.13 --- php4/php_ini.c:1.12 Wed Apr 21 13:28:54 1999 +++ php4/php_ini.c Wed Apr 28 16:26:29 1999 @@ -106,17 +106,17 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ return FAILURE; } - p = (char **) (base+(size_t) mh_arg); + p = (char **) (base+(size_t) mh_arg1); *p = new_value; return SUCCESS; Index: php4/php_ini.h diff -u php4/php_ini.h:1.5 php4/php_ini.h:1.6 --- php4/php_ini.h:1.5 Sat Apr 10 12:25:23 1999 +++ php4/php_ini.h Wed Apr 28 16:26:29 1999 @@ -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 @@ 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 @@ #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 } }; -- PHP 4 Beta

« previous php.version4 (#575) next »