Permalink
Browse files

Fixed bug in new module statrup mechanism

  • Loading branch information...
Dmitry Stogov
Dmitry Stogov committed Jul 18, 2005
1 parent e63d170 commit 70bd938bbdc264f94d6b480ae535636a241b5e3c
Showing with 12 additions and 12 deletions.
  1. +8 −8 Zend/zend_API.c
  2. +2 −2 Zend/zend_API.h
  3. +1 −1 ext/standard/dl.c
  4. +1 −1 main/main.c
View
@@ -1328,14 +1328,14 @@ ZEND_API int zend_startup_modules(TSRMLS_D)
return SUCCESS;
}
-ZEND_API int zend_register_module_ex(zend_module_entry *module TSRMLS_DC)
+ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC)
{
int name_len;
char *lcname;
zend_module_entry *module_ptr;
if (!module) {
- return FAILURE;
+ return NULL;
}
#if 0
@@ -1355,7 +1355,7 @@ ZEND_API int zend_register_module_ex(zend_module_entry *module TSRMLS_DC)
efree(lcname);
/* TODO: Check version relationship */
zend_error(E_CORE_WARNING, "Cannot load module '%s' because conflicting module '%s' is already loaded", module->name, dep->name);
- return FAILURE;
+ return NULL;
}
efree(lcname);
}
@@ -1369,20 +1369,20 @@ ZEND_API int zend_register_module_ex(zend_module_entry *module TSRMLS_DC)
if (zend_hash_add(&module_registry, lcname, name_len+1, (void *)module, sizeof(zend_module_entry), (void**)&module_ptr)==FAILURE) {
zend_error(E_CORE_WARNING, "Module '%s' already loaded", module->name);
efree(lcname);
- return FAILURE;
+ return NULL;
}
efree(lcname);
module = module_ptr;
if (module->functions && zend_register_functions(NULL, module->functions, NULL, module->type TSRMLS_CC)==FAILURE) {
zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load", module->name);
- return FAILURE;
+ return NULL;
}
- return SUCCESS;
+ return module;
}
-ZEND_API int zend_register_internal_module(zend_module_entry *module TSRMLS_DC)
+ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module TSRMLS_DC)
{
module->module_number = zend_next_free_module();
module->type = MODULE_PERSISTENT;
@@ -1656,7 +1656,7 @@ ZEND_API int zend_startup_module(zend_module_entry *module)
{
TSRMLS_FETCH();
- if (zend_register_internal_module(module TSRMLS_CC) == SUCCESS &&
+ if ((module = zend_register_internal_module(module TSRMLS_CC)) != NULL &&
zend_startup_module_ex(module TSRMLS_CC) == SUCCESS) {
return SUCCESS;
}
View
@@ -178,8 +178,8 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC,
ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
ZEND_API int zend_startup_module(zend_module_entry *module_entry);
-ZEND_API int zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC);
-ZEND_API int zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
+ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC);
+ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC);
ZEND_API int zend_startup_modules(TSRMLS_D);
ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC);
View
@@ -219,7 +219,7 @@ void php_dl(zval *file, int type, zval *return_value TSRMLS_DC)
module_entry->module_number = zend_next_free_module();
module_entry->handle = handle;
- if (zend_register_module_ex(module_entry TSRMLS_CC) == FAILURE) {
+ if ((module_entry = zend_register_module_ex(module_entry TSRMLS_CC)) == NULL) {
DL_UNLOAD(handle);
RETURN_FALSE;
}
View
@@ -1296,7 +1296,7 @@ int php_register_extensions(zend_module_entry **ptr, int count TSRMLS_DC)
while (ptr < end) {
if (*ptr) {
- if (zend_register_internal_module(*ptr TSRMLS_CC)==FAILURE) {
+ if (zend_register_internal_module(*ptr TSRMLS_CC)==NULL) {
return FAILURE;
}
}

0 comments on commit 70bd938

Please sign in to comment.