summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-04-08 21:32:57 +0000
committerZeev Suraski <zeev@php.net>1999-04-08 21:32:57 +0000
commit6a97e1662d03241806ced106ad864e57ef99b89f (patch)
tree701abf46f0712f95e449e52d4829a7f89b774ad2
parent9d8e0db38f3e489bec8e2f50b223800964f9e089 (diff)
downloadphp-git-6a97e1662d03241806ced106ad864e57ef99b89f.tar.gz
* Add arguments to shutdown function
* Bring php_ini uptodate
-rw-r--r--main/configuration-parser.y2
-rw-r--r--main/main.c7
-rw-r--r--main/php_ini.c42
-rw-r--r--main/php_ini.h59
4 files changed, 60 insertions, 50 deletions
diff --git a/main/configuration-parser.y b/main/configuration-parser.y
index 9a6e77470b..f4b9c33bed 100644
--- a/main/configuration-parser.y
+++ b/main/configuration-parser.y
@@ -278,7 +278,7 @@ int php3_shutdown_config(void)
}
-int php3_mshutdown_browscap(void)
+int php3_mshutdown_browscap(SHUTDOWN_FUNC_ARGS)
{
TLS_VARS;
diff --git a/main/main.c b/main/main.c
index b30446184f..3f0fb6ae64 100644
--- a/main/main.c
+++ b/main/main.c
@@ -594,7 +594,7 @@ void php3_request_shutdown(void *dummy INLINE_TLS)
GLOBAL(initialized) &= ~INIT_ENVIRONMENT; /* does not require any special shutdown */
- zend_ini_rshutdown();
+ php_ini_rshutdown();
shutdown_scanner(CLS_C);
@@ -917,7 +917,7 @@ int php3_module_startup(CLS_D ELS_DC)
zend_startup(&zuf, &zuv, NULL);
- zend_ini_mstartup();
+ php_ini_mstartup();
#if HAVE_SETLOCALE
setlocale(LC_CTYPE, "");
@@ -967,8 +967,6 @@ void php3_module_shutdown()
CLS_FETCH();
ELS_FETCH();
- zend_ini_mshutdown();
-
#if !USE_SAPI
/* close down the ini config */
php3_config_ini_shutdown(_INLINE_TLS_VOID);
@@ -993,6 +991,7 @@ void php3_module_shutdown()
#endif
zend_shutdown();
+ php_ini_mshutdown();
shutdown_memory_manager(0, 1);
}
diff --git a/main/php_ini.c b/main/php_ini.c
index 49464fdc99..32d18e2fe2 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -10,7 +10,7 @@ static HashTable known_directives;
/*
* hash_apply functions
*/
-static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number)
+static int php_remove_ini_entries(php_ini_entry *ini_entry, int *module_number)
{
if (ini_entry->module_number == *module_number) {
return 1;
@@ -20,7 +20,7 @@ static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number
}
-static int zend_restore_ini_entry(zend_ini_entry *ini_entry)
+static int php_restore_ini_entry(php_ini_entry *ini_entry)
{
if (ini_entry->modified) {
efree(ini_entry->value);
@@ -34,7 +34,7 @@ static int zend_restore_ini_entry(zend_ini_entry *ini_entry)
/*
* Startup / shutdown
*/
-int zend_ini_mstartup()
+int php_ini_mstartup()
{
if (_php3_hash_init(&known_directives, 100, NULL, NULL, 1)==FAILURE) {
return FAILURE;
@@ -43,16 +43,16 @@ int zend_ini_mstartup()
}
-int zend_ini_mshutdown()
+int php_ini_mshutdown()
{
_php3_hash_destroy(&known_directives);
return SUCCESS;
}
-int zend_ini_rshutdown()
+int php_ini_rshutdown()
{
- _php3_hash_apply(&known_directives, (int (*)(void *)) zend_restore_ini_entry);
+ _php3_hash_apply(&known_directives, (int (*)(void *)) php_restore_ini_entry);
return SUCCESS;
}
@@ -60,16 +60,16 @@ int zend_ini_rshutdown()
* Registration / unregistration
*/
-int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number)
+int php_register_ini_entries(php_ini_entry *ini_entry, int module_number)
{
- zend_ini_entry *p = ini_entry;
- zend_ini_entry *hashed_ini_entry;
+ php_ini_entry *p = ini_entry;
+ php_ini_entry *hashed_ini_entry;
pval *default_value;
while (p->name) {
p->module_number = module_number;
- if (_php3_hash_add(&known_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
- zend_unregister_ini_entries(module_number);
+ if (_php3_hash_add(&known_directives, p->name, p->name_length, p, sizeof(php_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
+ php_unregister_ini_entries(module_number);
return FAILURE;
}
if ((default_value=cfg_get_entry(p->name, p->name_length))) {
@@ -83,14 +83,14 @@ int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number)
}
-void zend_unregister_ini_entries(int module_number)
+void php_unregister_ini_entries(int module_number)
{
- _php3_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) zend_remove_ini_entries, (void *) &module_number);
+ _php3_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number);
}
-int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type)
+int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type)
{
- zend_ini_entry *ini_entry;
+ php_ini_entry *ini_entry;
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
return FAILURE;
@@ -112,9 +112,9 @@ int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new
* Data retrieval
*/
-long zend_ini_long(char *name, uint name_length)
+long php_ini_long(char *name, uint name_length)
{
- zend_ini_entry *ini_entry;
+ php_ini_entry *ini_entry;
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
return (long) atoi(ini_entry->value);
@@ -124,9 +124,9 @@ long zend_ini_long(char *name, uint name_length)
}
-double zend_ini_double(char *name, uint name_length)
+double php_ini_double(char *name, uint name_length)
{
- zend_ini_entry *ini_entry;
+ php_ini_entry *ini_entry;
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
return (double) strtod(ini_entry->value, NULL);
@@ -136,9 +136,9 @@ double zend_ini_double(char *name, uint name_length)
}
-char *zend_ini_string(char *name, uint name_length)
+char *php_ini_string(char *name, uint name_length)
{
- zend_ini_entry *ini_entry;
+ php_ini_entry *ini_entry;
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
return ini_entry->value;
diff --git a/main/php_ini.h b/main/php_ini.h
index 00d4a45ebf..38c6c7a771 100644
--- a/main/php_ini.h
+++ b/main/php_ini.h
@@ -1,18 +1,21 @@
-#ifndef _ZEND_INI_H
-#define _ZEND_INI_H
+#ifndef _PHP_INI_H
+#define _PHP_INI_H
-#define ZEND_INI_USER (1<<0)
-#define ZEND_INI_PERDIR (1<<1)
-#define ZEND_INI_SYSTEM (1<<2)
+#define PHP_INI_USER (1<<0)
+#define PHP_INI_PERDIR (1<<1)
+#define PHP_INI_SYSTEM (1<<2)
-#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
+#define PHP_INI_ALL (PHP_INI_USER|PHP_INI_PERDIR|PHP_INI_SYSTEM)
-typedef struct {
+typedef struct _php_ini_entry php_ini_entry;
+
+struct _php_ini_entry {
int module_number;
int modifyable;
char *name;
uint name_length;
+ int (*on_modify)(php_ini_entry *entry, pval *new_value);
char *value;
uint value_length;
@@ -20,29 +23,37 @@ typedef struct {
char *orig_value;
uint orig_value_length;
int modified;
-} zend_ini_entry;
+};
+
+
+int php_ini_mstartup();
+int php_ini_mshutdown();
+int php_ini_rshutdown();
+
+int php_register_ini_entries(php_ini_entry *ini_entry, int module_number);
+void php_unregister_ini_entries(int module_number);
+int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type);
+
+long php_ini_long(char *name, uint name_length);
+double php_ini_double(char *name, uint name_length);
+char *php_ini_string(char *name, uint name_length);
+#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = {
-int zend_ini_mstartup();
-int zend_ini_mshutdown();
-int zend_ini_rshutdown();
+#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \
+ { 0, modifyable, name, sizeof(name), on_modify, default_value, sizeof(default_value)-1, NULL, 0, 0 },
-int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number);
-void zend_unregister_ini_entries(int module_number);
-int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type);
+#define PHP_INI_END() \
+ { 0, 0, NULL, 0, NULL, NULL, 0, NULL, 0, 0 } };
-long zend_ini_long(char *name, uint name_length);
-double zend_ini_double(char *name, uint name_length);
-char *zend_ini_string(char *name, uint name_length);
+#define INI_INT(name) php_ini_long((name), sizeof(name))
+#define INI_FLT(name) php_ini_double((name), sizeof(name))
+#define INI_STR(name) php_ini_string((name), sizeof(name))
-#define ZEND_INI_BEGIN() static zend_ini_entry ini_entries[] = {
-#define ZEND_INI_ENTRY(name, default_value, modifyable) { 0, modifyable, name, sizeof(name), default_value, sizeof(default_value)-1, NULL, 0, 0 },
-#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, 0, NULL, 0, 0 } };
-#define INI_INT(name) zend_ini_long((name), sizeof(name))
-#define INI_FLT(name) zend_ini_double((name), sizeof(name))
-#define INI_STR(name) zend_ini_string((name), sizeof(name))
+#define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number)
+#define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number)
pval *cfg_get_entry(char *name, uint name_length);
-#endif /* _ZEND_INI_H */
+#endif /* _PHP_INI_H */