Discussion:
com php/gtk-src: More tsrmls_fetch removal: ext/gtk+/php_gtk+_types.c ext/spell/php_spell.c main/phpg_gobject.c
Elizabeth Marie Smith
2012-07-18 19:19:05 UTC
Permalink
Commit: 68a733751e399aee4e4d0056c52b17f72cc2e4a5
Author: Elizabeth M Smith <***@gmail.com> Wed, 18 Jul 2012 15:19:05 -0400
Parents: 598e23dcaf0669d68d497d7216eefd1bd5963e78
Branches: master

Link: http://git.php.net/?p=php/gtk-src.git;a=commitdiff;h=68a733751e399aee4e4d0056c52b17f72cc2e4a5

Log:
More tsrmls_fetch removal

Changed paths:
M ext/gtk+/php_gtk+_types.c
M ext/spell/php_spell.c
M main/phpg_gobject.c


Diff:
diff --git a/ext/gtk+/php_gtk+_types.c b/ext/gtk+/php_gtk+_types.c
index 8711947..d1ac6f5 100644
--- a/ext/gtk+/php_gtk+_types.c
+++ b/ext/gtk+/php_gtk+_types.c
@@ -1334,11 +1334,10 @@ static function_entry php_gdk_event_functions[] = {
{NULL, NULL, NULL}
};

-zval *php_gdk_event_new(GdkEvent *event)
+zval *php_gdk_event_new(GdkEvent *event TSRMLS_DC)
{
zval *result;
zval *value;
- TSRMLS_FETCH();

MAKE_STD_ZVAL(result);

diff --git a/ext/spell/php_spell.c b/ext/spell/php_spell.c
index 1f6bed0..56f0321 100644
--- a/ext/spell/php_spell.c
+++ b/ext/spell/php_spell.c
@@ -91,18 +91,14 @@ static function_entry gtkspell_methods[] = {
{ NULL, NULL, NULL }
};

-void phpg_gtkspell_register_classes(void)
+void phpg_gtkspell_register_classes(TSRMLS_D)
{
- TSRMLS_FETCH();

gtkspell_ce = phpg_register_class("GtkSpell", gtkspell_methods, gobject_ce, 0, NULL, NULL, 0 TSRMLS_CC);
}

void phpg_gtkspell_register_constants(const char *strip_prefix)
{
- TSRMLS_FETCH();
-
-
/* register gtype constants for all classes */

phpg_register_int_constant(gtkspell_ce, "gtype", sizeof("gtype")-1, 0);
@@ -118,7 +114,7 @@ PHP_GTK_GET_EXTENSION(spell)

PHP_GTK_XINIT_FUNCTION(spell)
{
- phpg_gtkspell_register_classes();
+ phpg_gtkspell_register_classes(TSRMLS_C);
phpg_gtkspell_register_constants("SPELL_");

return SUCCESS;
diff --git a/main/phpg_gobject.c b/main/phpg_gobject.c
index 3ed2be1..b1ce5b3 100644
--- a/main/phpg_gobject.c
+++ b/main/phpg_gobject.c
@@ -30,6 +30,7 @@
static GQuark gobject_wrapper_handle_key = 0;
static GQuark gobject_wrapper_handlers_key = 0;
static GQuark gobject_wrapper_owned_key = 0;
+static GQuark gobject_wrapper_zts_key = 0;

PHP_GTK_API zend_object_handlers phpg_gobject_handlers;

@@ -165,6 +166,9 @@ PHP_GTK_API void phpg_gobject_set_wrapper(zval *zobj, GObject *obj TSRMLS_DC)
pobj->is_owned = FALSE;
g_object_set_qdata(pobj->obj, gobject_wrapper_handle_key, (void*)Z_OBJ_HANDLE_P(zobj));
g_object_set_qdata(pobj->obj, gobject_wrapper_handlers_key, (void*)Z_OBJ_HT_P(zobj));
+#ifdef ZTS
+ g_object_set_qdata(pobj->obj, gobject_wrapper_zts_key, (void*)TSRMLS_C);
+#endif
}
/* }}} */

@@ -221,6 +225,9 @@ PHP_GTK_API void phpg_gobject_new(zval **zobj, GObject *obj TSRMLS_DC)
pobj->is_owned = FALSE;
g_object_set_qdata(obj, gobject_wrapper_handle_key, (void*)Z_OBJ_HANDLE_PP(zobj));
g_object_set_qdata(obj, gobject_wrapper_handlers_key, (void*)Z_OBJ_HT_PP(zobj));
+#ifdef ZTS
+ g_object_set_qdata(obj, gobject_wrapper_zts_key, (void*)TSRMLS_C);
+#endif
}
}
/* }}} */
@@ -936,7 +943,10 @@ static void phpg_object_get_property(GObject *object, guint property_id, GValue
zval *php_pspec = NULL;
zval *retval = NULL;

- TSRMLS_FETCH();
+#ifdef ZTS
+ TSRMLS_D = g_object_get_qdata(object, gobject_wrapper_zts_key);
+#endif
+
phpg_gobject_new(&php_object, object TSRMLS_CC);
phpg_paramspec_new(&php_pspec, pspec TSRMLS_CC);

@@ -962,7 +972,10 @@ static void phpg_object_set_property(GObject *object, guint property_id, const G
zval *php_value = NULL;
zval *retval = NULL;

- TSRMLS_FETCH();
+#ifdef ZTS
+ TSRMLS_D = g_object_get_qdata(object, gobject_wrapper_zts_key);
+#endif
+
if (phpg_gvalue_to_zval(value, &php_value, TRUE, TRUE TSRMLS_CC) == FAILURE) {
php_error(E_WARNING, "phpg_object_set_property: could not convert GValue to PHP value");
zval_ptr_dtor(&php_value);
@@ -988,10 +1001,9 @@ static void phpg_object_class_init(GObjectClass *class, zend_class_entry *ce)
class->set_property = phpg_object_set_property;
}

-static GParamSpec* phpg_create_property(const char *prop_name, GType prop_type, const char *nick, const char *blurb, zval *type_args, GParamFlags flags)
+static GParamSpec* phpg_create_property(const char *prop_name, GType prop_type, const char *nick, const char *blurb, zval *type_args, GParamFlags flags TSRMLS_DC)
{
GParamSpec *pspec = NULL;
- TSRMLS_FETCH();

switch (G_TYPE_FUNDAMENTAL(prop_type)) {
case G_TYPE_CHAR:
@@ -1152,7 +1164,7 @@ static GParamSpec* phpg_create_property(const char *prop_name, GType prop_type,
return pspec;
}

-static int phpg_register_properties(GType type, zval *properties)
+static int phpg_register_properties(GType type, zval *properties TSRMLS_DC)
{
GObjectClass *oclass;
GParamFlags flags;
@@ -1168,8 +1180,6 @@ static int phpg_register_properties(GType type, zval *properties)
zval *type_args = NULL;
zval *php_prop_type;

- TSRMLS_FETCH();
-
oclass = g_type_class_ref(type);
if (!oclass) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "couuld not get a reference to type class");
@@ -1217,7 +1227,7 @@ static int phpg_register_properties(GType type, zval *properties)
break;
}

- pspec = phpg_create_property(str_key, prop_type, nick, blurb, type_args, flags);
+ pspec = phpg_create_property(str_key, prop_type, nick, blurb, type_args, flags TSRMLS_CC);
if (pspec) {
g_object_class_install_property(oclass, 1, pspec);
} else {
@@ -1434,7 +1444,7 @@ static PHP_METHOD(GObject, register_type)
}
return;
}
- if (phpg_register_properties(new_type, *prop_decls) == FAILURE) {
+ if (phpg_register_properties(new_type, *prop_decls TSRMLS_CC) == FAILURE) {
if (free_name) {
g_free(type_name);
}
@@ -1475,7 +1485,7 @@ static PHP_METHOD(GObject, register_type)
}
return;
}
- if (phpg_register_properties(new_type, property) == FAILURE) {
+ if (phpg_register_properties(new_type, property TSRMLS_CC) == FAILURE) {
if (free_name) {
g_free(type_name);
}
@@ -1717,6 +1727,9 @@ void phpg_gobject_register_self(TSRMLS_D)
gobject_wrapper_handle_key = g_quark_from_static_string("phpg-wrapper-handle");
gobject_wrapper_handlers_key = g_quark_from_static_string("phpg-wrapper-handlers");
gobject_wrapper_owned_key = g_quark_from_static_string("phpg-wrapper-owned");
+#ifdef ZTS
+ gobject_wrapper_zts_key = g_quark_from_static_string("phpg-wrapper-zts");
+#endif

phpg_gobject_handlers = php_gtk_handlers;
phpg_gobject_handlers.del_ref = phpg_gobject_del_ref;
--
PHP-GTK CVS Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...