[Kde-bindings] KDE/kdebindings/php/phpqt/src
Thomas Moenicke
tm at php-qt.org
Sat Nov 1 01:27:13 UTC 2008
SVN commit 878381 by moenicke:
* removed all unnecessary calls that add or remove the class entry from/to the current scope
CCMAIL: kde-bindings at kde.org
M +5 -22 php_qt.cpp
M +0 -73 phpqt_internals.cpp
M +1 -4 smokephp.cpp
M +1 -1 zend_handlers.cpp
--- trunk/KDE/kdebindings/php/phpqt/src/php_qt.cpp #878380:878381
@@ -47,7 +47,7 @@
// context, threadsafe
QStack<QByteArray*> methodNameStack_;
-zend_class_entry* activeCe_;
+
zval* activeScope_;
bool parentCall_;
@@ -224,7 +224,6 @@
while ( PQ::smoke()->idClass(ce->name).index <= 0 ) {
ce = ce->parent; // ce_parent
}
- Context::setActiveCe( ce );
// get arguments
const int argc = ZEND_NUM_ARGS();
@@ -254,30 +253,18 @@
// cleanup
efree(args);
Context::removeMethodName();
-
return;
}
extern "C" ZEND_METHOD(php_qt_generic_class, proxyMethod)
{
Q_UNUSED(return_value_used);
- Context::setCallType( Context::MethodCall );
+
zend_class_entry *ce;
- if( Context::callType() == Context::StaticMethodCall )
- {
- ce = Context::activeCe();
- } else
- {
- ce = Z_OBJCE_P( getThis() );
- }
+ Context::setCallType( Context::MethodCall );
+ ce = Z_OBJCE_P( getThis() );
-#ifdef TEMP_DISABLED
- if( getThis() ) // nonstatic
- ce = Z_OBJCE_P( getThis() );
- else // static
-#endif
-
// find parents
while (PQ::smoke()->idClass(ce->name).index <= 0) {
ce = ce->parent;
@@ -298,7 +285,6 @@
{
pNotice() << "called static method on an object" << Context::methodName();
this_ptr = 0;
- Context::setActiveCe( ce );
}
if(method <= 0) { // its a user signal
@@ -360,8 +346,6 @@
// cleanup
efree(args);
Context::removeMethodName();
- if( Context::callType() == Context::StaticMethodCall )
- Context::removeActiveCe();
return;
} // proxyMethod
@@ -373,11 +357,10 @@
ALLOC_INIT_ZVAL( this_ptr );
object_init_ex( this_ptr, Context::activeCe() );
+ Context::removeActiveCe();
// forward to proxyMethod
zim_php_qt_generic_class_proxyMethod(ht, return_value, return_value_ptr, this_ptr, return_value_used);
- // we assume the active ce has been used
- Context::removeActiveCe();
Context::setCallType( Context::MethodCall );
}
--- trunk/KDE/kdebindings/php/phpqt/src/phpqt_internals.cpp #878380:878381
@@ -513,80 +513,7 @@
}
// TODO here set QMultiMap
}
-/*
-void
-PHPQt::Context::setActiveCe(zend_class_entry* ce)
-{
- extern zend_class_entry* activeCe_;
- activeCe_ = ce;
-}
-zend_class_entry*
-PHPQt::Context::activeCe()
-{
- extern zend_class_entry* activeCe_;
- return activeCe_;
-}
-
-zval*
-PHPQt::Context::activeScope()
-{
- extern zval* activeScope_;
- return activeScope_;
-}
-
-void
-PHPQt::Context::setActiveScope(zval* zval_ptr)
-{
- extern zval* activeScope_;
- activeScope_ = zval_ptr;
-}
-
-void
-PHPQt::Context::setParentCall(bool pc)
-{
- extern bool parentCall_;
- parentCall_ = pc;
-}
-
-bool
-PHPQt::Context::parentCall()
-{
- extern bool parentCall_;
- return parentCall_;
-}
-
-void
-PHPQt::Context::setMethodName(const char* name)
-{
- extern QStack<QByteArray*> methodNameStack_;
- methodNameStack_.push( new QByteArray(name) );
-}
-
-void
-PHPQt::Context::removeMethodName()
-{
- extern QStack<QByteArray*> methodNameStack_;
- methodNameStack_.pop();
-}
-
-QByteArray*
-PHPQt::Context::methodName()
-{
- extern QStack<QByteArray*> methodNameStack_;
- return methodNameStack_.top();
-}
-
-const char*
-PHPQt::Context::methodNameC()
-{
- extern QStack<QByteArray*> methodNameStack_;
- return methodNameStack_.top()->constData();
-}
-
-*/
-
-
/*!
* check_qobject()
*
--- trunk/KDE/kdebindings/php/phpqt/src/smokephp.cpp #878380:878381
@@ -95,11 +95,10 @@
{
Context::setCallType( Context::VirtualMethodCall );
pDebug( PHPQt::VirtualMethod ) << methodName << "with" << smoke->methods[method].numArgs << "arguments";
- Context::setActiveCe( const_cast<zend_class_entry*>(o->ce_ptr()) );
zval** zmem = (zval**) safe_emalloc( smoke->methods[method].numArgs, sizeof(zval*), 0 );
// ALLOC_INIT_ZVAL allocates memory using emalloc and
- // initialized the zval to a IS_NULL type
+ // initialized the zval to type IS_NULL
for(int i=0;i<smoke->methods[method].numArgs;i++)
{
ALLOC_INIT_ZVAL( zmem[i] );
@@ -108,8 +107,6 @@
VirtualMethodCall c(smoke, method, args, const_cast<zval*>( o->zval_ptr() ), zmem);
c.next();
efree(zmem);
- Context::removeActiveCe();
-
return true;
}
--- trunk/KDE/kdebindings/php/phpqt/src/zend_handlers.cpp #878380:878381
@@ -148,7 +148,7 @@
{
zend_op *opline = EX(opline);
zend_class_entry *ce = EX_T(opline->op1.u.var).class_entry;
- Context::setActiveCe( ce );
+
union _zend_function *fbc;
zval* function_name;
char* function_name_strval;
More information about the Kde-bindings
mailing list