]> granicus.if.org Git - php/commitdiff
Almost forgot to commit those
authorZeev Suraski <zeev@php.net>
Sun, 9 May 1999 12:24:21 +0000 (12:24 +0000)
committerZeev Suraski <zeev@php.net>
Sun, 9 May 1999 12:24:21 +0000 (12:24 +0000)
Zend/zend.c
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_modules.h

index b6f81a69cc7c850c420d908ab4c9ded53b9020be..70e65349ed228f3219b36680e650794f18d12d8c 100644 (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);
index 4b1ac8e2ba0d3f2c9e5b8bfdc51f68a2d7e94889..49ed26dbe95ed688b9205776d80746aab381ffde 100644 (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;
+       }
+}
index ddc17f880705c37d089fbf89fa25914b1522169a..8df14d2a04bcb20d8affdf0e5f52a093c098c22a 100644 (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);
 
index f4805f0663002482f95a8c445864de22a124c7a7..b0838953ec29b5983032018220fea9aa3d1e319a 100644 (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
 
 #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;