Skip to content

Commit

Permalink
Kill another TSRMLS_FETCH() in the zend extension loading code
Browse files Browse the repository at this point in the history
  • Loading branch information
KalleZ committed Dec 18, 2013
1 parent 2eb9bd3 commit bd58146
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
12 changes: 5 additions & 7 deletions Zend/zend_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
ZEND_API zend_llist zend_extensions;
static int last_resource_number;

int zend_load_extension(const char *path)
int zend_load_extension(const char *path TSRMLS_DC)
{
#if ZEND_EXTENSIONS_SUPPORT
DL_HANDLE handle;
Expand Down Expand Up @@ -107,7 +107,7 @@ int zend_load_extension(const char *path)
return FAILURE;
}

return zend_register_extension(new_extension, handle);
return zend_register_extension(new_extension, handle TSRMLS_CC);
#else
fprintf(stderr, "Extensions are not supported on this platform.\n");
/* See http://support.microsoft.com/kb/190351 */
Expand All @@ -119,15 +119,15 @@ int zend_load_extension(const char *path)
}


int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle)
int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle TSRMLS_DC)
{
#if ZEND_EXTENSIONS_SUPPORT
zend_extension extension;

extension = *new_extension;
extension.handle = handle;

zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension TSRMLS_CC);

zend_llist_add_element(&zend_extensions, &extension);

Expand Down Expand Up @@ -208,10 +208,8 @@ static void zend_extension_message_dispatcher(const zend_extension *extension, i
}


ZEND_API void zend_extension_dispatch_message(int message, void *arg)
ZEND_API void zend_extension_dispatch_message(int message, void *arg TSRMLS_DC)
{
TSRMLS_FETCH();

zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg);
}

Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct _zend_extension {

BEGIN_EXTERN_C()
ZEND_API int zend_get_resource_handle(zend_extension *extension);
ZEND_API void zend_extension_dispatch_message(int message, void *arg);
ZEND_API void zend_extension_dispatch_message(int message, void *arg TSRMLS_DC);
END_EXTERN_C()

#define ZEND_EXTMSG_NEW_EXTENSION 1
Expand All @@ -117,8 +117,8 @@ int zend_startup_extensions(void);
void zend_shutdown_extensions(TSRMLS_D);

BEGIN_EXTERN_C()
ZEND_API int zend_load_extension(const char *path);
ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
ZEND_API int zend_load_extension(const char *path TSRMLS_DC);
ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle TSRMLS_DC);
ZEND_API zend_extension *zend_get_extension(const char *extension_name);
END_EXTERN_C()

Expand Down
4 changes: 2 additions & 2 deletions main/php_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
int length = strlen(filename);

if (IS_ABSOLUTE_PATH(filename, length)) {
zend_load_extension(filename);
zend_load_extension(filename TSRMLS_CC);
} else {
char *libpath;
char *extension_dir = INI_STR("extension_dir");
Expand All @@ -372,7 +372,7 @@ static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
} else {
spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename);
}
zend_load_extension(libpath);
zend_load_extension(libpath TSRMLS_CC);
efree(libpath);
}
}
Expand Down
2 changes: 1 addition & 1 deletion sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2240,7 +2240,7 @@ consult the installation file that came with this distribution, or visit \n\
break;

case 'z': /* load extension file */
zend_load_extension(php_optarg);
zend_load_extension(php_optarg TSRMLS_CC);
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
break;

case 'z': /* load extension file */
zend_load_extension(php_optarg);
zend_load_extension(php_optarg TSRMLS_CC);
break;
case 'H':
hide_argv = 1;
Expand Down
2 changes: 1 addition & 1 deletion sapi/milter/php_milter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ int main(int argc, char *argv[])
break;

case 'z': /* load extension file */
zend_load_extension(ap_php_optarg);
zend_load_extension(ap_php_optarg TSRMLS_CC);
break;

default:
Expand Down

0 comments on commit bd58146

Please sign in to comment.