CVS update: php4

From: Date: Sat, 19 Jun 1999 19:23:25 +0000
Subject: CVS update: php4
Groups: php.version4 
Request: Send a blank email to php-version4+get-1602@lists.php.net to get a copy of this message
Date: Saturday June 19, 1999 @ 15:23 Author: zeev Update of /repository/php4 In directory php:/tmp/cvs-serv22830 Modified Files: main.c php_ini.c php_ini.h Log Message: Implement new get_ini_entry() for Zend Index: php4/main.c diff -u php4/main.c:1.74 php4/main.c:1.75 --- php4/main.c:1.74 Wed Jun 16 13:06:51 1999 +++ php4/main.c Sat Jun 19 15:23:24 1999 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.74 1999/06/16 17:06:51 ssb Exp $ */ +/* $Id: main.c,v 1.75 1999/06/19 19:23:24 zeev Exp $ */ #include <stdio.h> @@ -551,6 +551,21 @@ } +static int php_get_ini_entry_for_zend(char *name, uint name_length, zval *contents) +{ + php_ini_entry *ini_entry = get_ini_entry(name, name_length); + + if (ini_entry) { + contents->type = IS_STRING; + contents->value.str.val = ini_entry->value; + contents->value.str.len = ini_entry->value_length; + return SUCCESS; + } else { + return FAILURE; + } +} + + static void php_message_handler_for_zend(long message, void *data) { switch (message) { @@ -790,7 +805,7 @@ zuf.message_handler = php_message_handler_for_zend; zuf.block_interruptions = BLOCK_INTERRUPTIONS; zuf.unblock_interruptions = UNBLOCK_INTERRUPTIONS; - + zuf.get_ini_entry = php_get_ini_entry_for_zend; zend_startup(&zuf, NULL); #ifdef ZTS Index: php4/php_ini.c diff -u php4/php_ini.c:1.22 php4/php_ini.c:1.23 --- php4/php_ini.c:1.22 Fri Jun 4 06:45:53 1999 +++ php4/php_ini.c Sat Jun 19 15:23:24 1999 @@ -73,7 +73,7 @@ */ int php_ini_mstartup() { - if (_php3_hash_init(&known_directives, 100, NULL, NULL, 1)==FAILURE) { + if (zend_hash_init(&known_directives, 100, NULL, NULL, 1)==FAILURE) { return FAILURE; } return SUCCESS; @@ -82,14 +82,14 @@ int php_ini_mshutdown() { - _php3_hash_destroy(&known_directives); + zend_hash_destroy(&known_directives); return SUCCESS; } int php_ini_rshutdown() { - _php3_hash_apply(&known_directives, (int (*)(void *)) php_restore_ini_entry_cb); + zend_hash_apply(&known_directives, (int (*)(void *)) php_restore_ini_entry_cb); return SUCCESS; } @@ -105,7 +105,7 @@ while (p->name) { p->module_number = module_number; - if (_php3_hash_add(&known_directives, p->name, p->name_length, p, sizeof(php_ini_entry), (void **) &hashed_ini_entry)==FAILURE) { + if (zend_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; } @@ -132,7 +132,7 @@ PHPAPI void php_unregister_ini_entries(int module_number) { - _php3_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number); + zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number); } @@ -141,7 +141,7 @@ php_ini_entry *ini_entry; char *duplicate; - if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { + if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { return FAILURE; } @@ -174,7 +174,7 @@ { php_ini_entry *ini_entry; - if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { + if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { return FAILURE; } @@ -187,7 +187,7 @@ { php_ini_entry *ini_entry; - if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { + if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { return FAILURE; } @@ -205,7 +205,7 @@ { php_ini_entry *ini_entry; - if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { if (orig && ini_entry->modified) { return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0); } else if (ini_entry->value) { @@ -221,7 +221,7 @@ { php_ini_entry *ini_entry; - if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { if (orig && ini_entry->modified) { return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0); } else if (ini_entry->value) { @@ -237,7 +237,7 @@ { php_ini_entry *ini_entry; - if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { if (orig && ini_entry->modified) { return ini_entry->orig_value; } else { @@ -248,6 +248,17 @@ return ""; } + +php_ini_entry *get_ini_entry(char *name, uint name_length) +{ + php_ini_entry *ini_entry; + + if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { + return ini_entry; + } else { + return NULL; + } +} static void php_ini_displayer_cb(php_ini_entry *ini_entry, int type) Index: php4/php_ini.h diff -u php4/php_ini.h:1.10 php4/php_ini.h:1.11 --- php4/php_ini.h:1.10 Fri Jun 4 06:45:53 1999 +++ php4/php_ini.h Sat Jun 19 15:23:24 1999 @@ -46,6 +46,7 @@ PHPAPI long php_ini_long(char *name, uint name_length, int orig); PHPAPI double php_ini_double(char *name, uint name_length, int orig); PHPAPI char *php_ini_string(char *name, uint name_length, int orig); +php_ini_entry *get_ini_entry(char *name, uint name_length); PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type)); PHPAPI PHP_INI_DISP(php_ini_boolean_displayer_cb);

« previous php.version4 (#1602) next »