Almost forgot to commit those

This commit is contained in:
Zeev Suraski 1999-05-09 12:24:21 +00:00
parent bc415d5a88
commit bfbe86187e
4 changed files with 32 additions and 8 deletions

View File

@ -204,12 +204,14 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals)
static void executor_globals_ctor(zend_executor_globals *executor_globals)
{
zend_startup_constants(ELS_C);
init_resource_plist(ELS_C);
}
static void executor_globals_dtor(zend_executor_globals *executor_globals)
{
zend_shutdown_constants(ELS_C);
destroy_resource_plist();
}
@ -275,7 +277,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions)
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
#endif
#ifndef ZTS
init_resource_plist(ELS_C);
#endif
return SUCCESS;
}
@ -283,7 +287,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions)
void zend_shutdown()
{
#ifndef ZTS
destroy_resource_plist();
#endif
zend_hash_destroy(&list_destructors);
zend_hash_destroy(&module_registry);
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);

View File

@ -675,7 +675,7 @@ ZEND_API int zend_register_module(zend_module_entry *module)
#if 0
zend_printf("%s: Registering module %d\n",module->name, module->module_number);
#endif
if (zend_register_functions(module->functions)==FAILURE) {
if (module->functions && zend_register_functions(module->functions)==FAILURE) {
zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load",module->name);
return FAILURE;
}
@ -705,7 +705,9 @@ void module_destructor(zend_module_entry *module)
module->module_shutdown_func(module->type, module->module_number);
}
module->module_started=0;
zend_unregister_functions(module->functions,-1);
if (module->functions) {
zend_unregister_functions(module->functions,-1);
}
#if HAVE_LIBDL
if (module->handle) {
@ -760,7 +762,7 @@ int zend_next_free_module(void)
}
zend_class_entry *register_internal_class(zend_class_entry *class_entry)
ZEND_API zend_class_entry *register_internal_class(zend_class_entry *class_entry)
{
zend_class_entry *register_class;
char *lowercase_name = zend_strndup(class_entry->name, class_entry->name_length);
@ -779,3 +781,15 @@ zend_class_entry *register_internal_class(zend_class_entry *class_entry)
free(lowercase_name);
return register_class;
}
ZEND_API zend_module_entry *zend_get_module(int module_number)
{
zend_module_entry *module;
if (zend_hash_index_find(&module_registry, module_number, (void **) &module)==SUCCESS) {
return module;
} else {
return NULL;
}
}

View File

@ -41,7 +41,8 @@ ZEND_API int ParameterPassedByReference(int ht, uint n);
int zend_register_functions(zend_function_entry *functions);
void zend_unregister_functions(zend_function_entry *functions, int count);
ZEND_API int zend_register_module(zend_module_entry *module_entry);
zend_class_entry *register_internal_class(zend_class_entry *class_entry);
ZEND_API zend_class_entry *register_internal_class(zend_class_entry *class_entry);
ZEND_API zend_module_entry *zend_get_module(int module_number);
ZEND_API void wrong_param_count(void);

View File

@ -19,6 +19,7 @@
#define INIT_FUNC_ARGS int type, int module_number
#define SHUTDOWN_FUNC_ARGS int type, int module_number
#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *module
#define STANDARD_MODULE_PROPERTIES 0, 0, 0, NULL, 0
@ -26,19 +27,21 @@
#define MODULE_PERSISTENT 1
#define MODULE_TEMPORARY 2
typedef struct {
typedef struct _zend_module_entry zend_module_entry;
struct _zend_module_entry {
char *name;
zend_function_entry *functions;
int (*module_startup_func)(INIT_FUNC_ARGS);
int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
int (*request_startup_func)(INIT_FUNC_ARGS);
int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
void (*info_func)(void);
int request_started,module_started;
void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
int request_started, module_started;
unsigned char type;
void *handle;
int module_number;
} zend_module_entry;
};
extern HashTable module_registry;