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();
}
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
#endif
+#ifndef ZTS
init_resource_plist(ELS_C);
+#endif
return SUCCESS;
}
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);
#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;
}
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) {
}
-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);
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;
+ }
+}
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);
#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
#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;