>>Why not just rewrite it?
>>
> 
>     For me, because I don't get paid for it and don't have that
>     much spare time.
> 

Me neither :) It's still better than broken code, IMHO.
I don't mind making these changes for php_domxml.c if you would like.
(TSRMLS_FETCH => TSRMLS_D, TSRMLS_C)

-- following lines are for those who are not familer with TSRM, yet  --

Anyway, module maintainers/developers *should* know about
how TSRM works and test build at least. (Build with -DZTS)

With PHP_* macro, there is no need to fetch resource
with TSRMLS_FETCH(), since it defined already.
(PHP_MINIT/PHP_FUNCTION/etc)

If function defiend by PHP_FUNCTION() calls other
fucntion requires TSRMLS_C or TSRMLS_CC (TSRMLS_C with comma),
pass TSRMLS_C to the function instead of fetching every time
for efficiency.

Use TSRMLS_D or TSRMLS_DC (TSRMLS_D with comma) for function
definitions/prototypes.

== from TSRM.h ===

#define TSRMLS_FETCH() void ***tsrm_ls = \
                             (void ***) ts_resource_ex(0, NULL)
#define TSRMLS_D   void ***tsrm_ls
#define TSRMLS_DC  , TSRMLS_D
#define TSRMLS_C   tsrm_ls
#define TSRMLS_CC  , TSRMLS_C

TSRMLS_C is a pointer to TSRM resource list. TSRMLS_FETCH fetches
TSRM resource list, if it is not available in a function.

TSRMLS_FETCH is actually calling ts_resource_ex() and ts_resource_ex()
is *not* a simpile function. If TSRMLS_C is available in caller
function, TSRMLS_C should be used instead of TSRMLS_FETCH for
performance.

Module should also initialize TSRM resource in MINIT. See
session or other internal modules how it should be done.

BTW, for 4.2.0, all module are supposed to be ZTS safe ;)
IIRC, TSRM stands for Thread Safe Resource Manager
and ZTS stands for Zend Thread Safty. All of know about
it right?

Just my .02

-- 
Yasuo Ohgaki


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to