From fcf0afce176ead51d7012b897ad030e870de631b Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Wed, 29 Mar 2000 19:26:34 +0000 Subject: [PATCH] *** empty log message *** --- Zend/zend_extensions.c | 25 ++++++++++++++++++------- Zend/zend_extensions.h | 5 +++-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 51264b3c8e109..50b3dd47e5e92 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -44,7 +44,7 @@ int zend_load_extension(char *path) { #if ZEND_EXTENSIONS_SUPPORT DL_HANDLE handle; - zend_extension extension, *new_extension; + zend_extension *new_extension; zend_extension_version_info *extension_version_info; handle = DL_LOAD(path); @@ -106,21 +106,30 @@ int zend_load_extension(char *path) return FAILURE; } } + return zend_register_extension(new_extension, handle); +#else + fprintf(stderr, "Extensions are not supported on this platform.\n"); + return FAILURE; +#endif +} + + +int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) +{ + zend_extension extension; + extension = *new_extension; extension.handle = handle; zend_llist_add_element(&zend_extensions, &extension); + zend_append_version_info(&extension); /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/ - zend_append_version_info(&extension); return SUCCESS; -#else - fprintf(stderr, "Extensions are not supported on this platform.\n"); - return FAILURE; -#endif } + static void zend_extension_shutdown(zend_extension *extension) { #if ZEND_EXTENSIONS_SUPPORT @@ -141,7 +150,9 @@ void zend_shutdown_extensions() void zend_extension_dtor(zend_extension *extension) { #if ZEND_EXTENSIONS_SUPPORT - DL_UNLOAD(extension->handle); + if (extension->handle) { + DL_UNLOAD(extension->handle); + } #endif } diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 13ef58d933b2d..24abb5be03936 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -88,8 +88,9 @@ ZEND_API int zend_get_resource_handle(zend_extension *extension); ZEND_API extern zend_llist zend_extensions; void zend_extension_dtor(zend_extension *extension); -int zend_load_extension(char *path); -int zend_load_extensions(char **extension_paths); +ZEND_API int zend_load_extension(char *path); +ZEND_API int zend_load_extensions(char **extension_paths); +ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); void zend_append_version_info(zend_extension *extension); void zend_shutdown_extensions(void);