diff options
| -rw-r--r-- | php_rpminfo.h | 4 | ||||
| -rw-r--r-- | rpminfo.c | 27 | 
2 files changed, 17 insertions, 14 deletions
diff --git a/php_rpminfo.h b/php_rpminfo.h index 2caee6b..b87b9f0 100644 --- a/php_rpminfo.h +++ b/php_rpminfo.h @@ -40,10 +40,6 @@ ZEND_BEGIN_MODULE_GLOBALS(rpminfo)  	rpmts ts;  ZEND_END_MODULE_GLOBALS(rpminfo) -/* Always refer to the globals in your function as RPMINFO_G(variable). -   You are encouraged to rename these macros something shorter, see -   examples in any other php module directory. -*/  #define RPMINFO_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(rpminfo, v)  #if defined(ZTS) && defined(COMPILE_DL_RPMINFO) @@ -42,13 +42,6 @@ static rpmts rpminfo_getts(rpmVSFlags flags) {  	return RPMINFO_G(ts);  } -static void rpminfo_freets(void) { -	if (RPMINFO_G(ts)) { -		rpmtsFree(RPMINFO_G(ts)); -		RPMINFO_G(ts) = NULL; -	} -} -  ZEND_BEGIN_ARG_INFO_EX(arginfo_rpminfo, 0, 0, 1)  	ZEND_ARG_INFO(0, path)  	ZEND_ARG_INFO(0, full) @@ -170,6 +163,18 @@ PHP_FUNCTION(rpmvercmp)  }  /* }}} */ +/* Remove if there's nothing to do at request start */ +/* {{{ PHP_RINIT_FUNCTION + */ +PHP_RINIT_FUNCTION(rpminfo) +{ +#if defined(COMPILE_DL_RPMINFO) && defined(ZTS) +	ZEND_TSRMLS_CACHE_UPDATE(); +#endif +	return SUCCESS; +} +/* }}} */ +  /* {{{ PHP_MINFO_FUNCTION   */  PHP_MINFO_FUNCTION(rpminfo) @@ -193,7 +198,6 @@ static PHP_GINIT_FUNCTION(rpminfo) /* {{{ */  #if defined(COMPILE_DL_SESSION) && defined(ZTS)  	ZEND_TSRMLS_CACHE_UPDATE();  #endif -  	rpminfo_globals->ts = NULL;  }  /* }}} */ @@ -202,7 +206,10 @@ static PHP_GINIT_FUNCTION(rpminfo) /* {{{ */  */  PHP_GSHUTDOWN_FUNCTION(rpminfo)  { -	rpminfo_freets(); +	if (rpminfo_globals->ts) { +		rpmtsFree(rpminfo_globals->ts); +		rpminfo_globals->ts = NULL; +	}  }  /* }}} */ @@ -227,7 +234,7 @@ zend_module_entry rpminfo_module_entry = {  	rpminfo_functions,  	NULL,  	NULL, -	NULL, +	PHP_RINIT(rpminfo),  	NULL,  	PHP_MINFO(rpminfo),  	PHP_RPMINFO_VERSION,  | 
