com gtk/php-gtk: Improve php_gtk_check_class() func tion.: main/php_gtk_util.c

[email protected] (David Soria Parra)
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    1a5a2dfe4851c48cc576b81cc90a07482a88d404
Author:    Andrei Zmievski <[email protected]>         Sat, 3 Jun 2006 19:33:24 +0000
Parents:   c51f9434701b67d3a2431acec9dceab11bd0c61d
Branches:  master

Link:       http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=1a5a2dfe4851c48cc576b81cc90a07482a88d404

Log:
Improve php_gtk_check_class() function.

Changed paths:
  M  main/php_gtk_util.c


Diff:
1a5a2dfe4851c48cc576b81cc90a07482a88d404
diff --git a/main/php_gtk_util.c b/main/php_gtk_util.c
index d2720cc..f623570 100644
--- a/main/php_gtk_util.c
+++ b/main/php_gtk_util.c
@@ -569,18 +569,13 @@ PHP_GTK_API int php_gtk_parse_args_hash_quiet(zval *hash, char *format, ...)
 
 PHP_GTK_API int php_gtk_check_class(zval *wrapper, zend_class_entry *expected_ce)
 {
-	zend_class_entry *ce;
-	TSRMLS_FETCH();
-
 	if (Z_TYPE_P(wrapper) != IS_OBJECT)
 		return 0;
 
-	for (ce = Z_OBJCE_P(wrapper); ce != NULL; ce = ce->parent) {
-		if (ce == expected_ce)
-			return 1;
-	}
-
-	return 0;
+	if (instanceof_function(Z_OBJCE_P(wrapper), expected_ce))
+		return 1;
+	else
+		return 0;
 }
 
 PHP_GTK_API void php_gtk_invalidate(zval *wrapper)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.