diff options
author | Zeev Suraski <zeev@php.net> | 2001-07-31 05:44:11 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2001-07-31 05:44:11 +0000 |
commit | aa1772ca7263173ee47af0d83fea866f194757ba (patch) | |
tree | a8ea8932a07875a43423a8ffcd0100eab0c0f8a7 /ext | |
parent | 57507b4ea6bb2a38578444ca8359806f241fa8f5 (diff) | |
download | php-git-aa1772ca7263173ee47af0d83fea866f194757ba.tar.gz |
More TSRMLS_FETCH annihilation
Diffstat (limited to 'ext')
58 files changed, 219 insertions, 182 deletions
diff --git a/ext/aspell/aspell.c b/ext/aspell/aspell.c index e7f1be9a31..d4acf3be82 100644 --- a/ext/aspell/aspell.c +++ b/ext/aspell/aspell.c @@ -60,9 +60,10 @@ ZEND_GET_MODULE(aspell) /* {{{ php_aspell_close */ -static void php_aspell_close(zend_rsrc_list_entry *rsrc) +static void php_aspell_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) { aspell *sc = (aspell *)rsrc->ptr; + aspell_free(sc); } /* }}} */ diff --git a/ext/com/COM.c b/ext/com/COM.c index a9d18cec9f..cb60f4d2a8 100644 --- a/ext/com/COM.c +++ b/ext/com/COM.c @@ -335,9 +335,10 @@ static char *php_string_from_clsid(const CLSID *clsid) return clsid_str; } -static void php_comval_destructor(zend_rsrc_list_entry *rsrc) +static void php_comval_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { comval *obj = (comval *)rsrc->ptr; + if(C_ISREFD(obj)) { C_REFCOUNT(obj) = 1; diff --git a/ext/com/VARIANT.c b/ext/com/VARIANT.c index af435bacbd..8f9ebd0e2d 100644 --- a/ext/com/VARIANT.c +++ b/ext/com/VARIANT.c @@ -42,7 +42,7 @@ void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_proper pval php_VARIANT_get_property_handler(zend_property_reference *property_reference); static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value); void php_register_VARIANT_class(); -static void php_variant_destructor(zend_rsrc_list_entry *rsrc); +static void php_variant_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC); void php_register_VARIANT_class(); static int le_variant; @@ -423,7 +423,7 @@ static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value) return SUCCESS; } -static void php_variant_destructor(zend_rsrc_list_entry *rsrc) +static void php_variant_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { efree(rsrc); } diff --git a/ext/cpdf/cpdf.c b/ext/cpdf/cpdf.c index 087ad405eb..bb1ce59fca 100644 --- a/ext/cpdf/cpdf.c +++ b/ext/cpdf/cpdf.c @@ -162,13 +162,14 @@ zend_module_entry cpdf_module_entry = { ZEND_GET_MODULE(cpdf) #endif -static void _free_outline(zend_rsrc_list_entry *rsrc) +static void _free_outline(zend_rsrc_list_entry *rsrc TSRMLS_DC) { } -static void _free_doc(zend_rsrc_list_entry *rsrc) +static void _free_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { CPDFdoc *pdf = (CPDFdoc *)rsrc->ptr; + cpdf_close(pdf); } diff --git a/ext/curl/curl.c b/ext/curl/curl.c index 2d74030608..a5f2f66f68 100644 --- a/ext/curl/curl.c +++ b/ext/curl/curl.c @@ -44,7 +44,7 @@ static int le_curl; #define le_curl_name "cURL handle" -static void _php_curl_close(zend_rsrc_list_entry *rsrc); +static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC); #define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err; @@ -995,7 +995,7 @@ PHP_FUNCTION(curl_close) /* {{{ _php_curl_close() List destructor for curl handles */ -static void _php_curl_close(zend_rsrc_list_entry *rsrc) +static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_curl *ch = (php_curl *) rsrc->ptr; diff --git a/ext/db/db.c b/ext/db/db.c index 018981af5f..8a59b91c75 100644 --- a/ext/db/db.c +++ b/ext/db/db.c @@ -440,7 +440,8 @@ PHP_FUNCTION(dbmclose) { /* {{{ php_dbm_close */ -int php_dbm_close(zend_rsrc_list_entry *rsrc) { +int php_dbm_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ int ret = 0; dbm_info *info = (dbm_info *)rsrc->ptr; DBM_TYPE dbf; diff --git a/ext/db/php_db.h b/ext/db/php_db.h index e635033e65..61c3a48e86 100644 --- a/ext/db/php_db.h +++ b/ext/db/php_db.h @@ -52,7 +52,7 @@ typedef struct dbm_info { #endif dbm_info *php_find_dbm(pval *id); -int php_dbm_close(zend_rsrc_list_entry *rsrc); +int php_dbm_close(zend_rsrc_list_entry *rsrc TSRMLS_DC); dbm_info *php_dbm_open(char *filename, char *mode); int php_dbm_insert(dbm_info *info, char *key, char *value); char *php_dbm_fetch(dbm_info *info, char *key); diff --git a/ext/dba/dba.c b/ext/dba/dba.c index e64adaaaf1..542497c9be 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -183,9 +183,10 @@ static void dba_close(dba_info *info) /* {{{ dba_close_rsrc */ -static void dba_close_rsrc(zend_rsrc_list_entry *rsrc) +static void dba_close_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { dba_info *info = (dba_info *)rsrc->ptr; + dba_close(info); } /* }}} */ diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c index bbb93558cf..c9d870a61c 100644 --- a/ext/dbase/dbase.c +++ b/ext/dbase/dbase.c @@ -61,9 +61,10 @@ static int le_dbhead; #include <errno.h> -static void _close_dbase(zend_rsrc_list_entry *rsrc) +static void _close_dbase(zend_rsrc_list_entry *rsrc TSRMLS_DC) { dbhead_t *dbhead = (dbhead_t *)rsrc->ptr; + close(dbhead->db_fd); free_dbf_head(dbhead); } diff --git a/ext/dbplus/dbplus.c b/ext/dbplus/dbplus.c index 816a55960e..fc136bb84f 100644 --- a/ext/dbplus/dbplus.c +++ b/ext/dbplus/dbplus.c @@ -36,12 +36,16 @@ ZEND_GET_MODULE(dbplus) int le_dbplus_relation; int le_dbplus_tupel; -void dbplus_destruct_relation(zend_rsrc_list_entry *rsrc) { +void dbplus_destruct_relation(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ relf *conn = (relf *)(rsrc->ptr); + cdb_close(conn); } -void dbplus_destruct_tupel(zend_rsrc_list_entry *rsrc) { + +void dbplus_destruct_tupel(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ tuple *t = (tuple *)(rsrc->ptr); efree(t); diff --git a/ext/dbplus/php_dbplus.h b/ext/dbplus/php_dbplus.h index ab72fb2dfa..09ab878f65 100644 --- a/ext/dbplus/php_dbplus.h +++ b/ext/dbplus/php_dbplus.h @@ -114,8 +114,8 @@ ZEND_END_MODULE_GLOBALS(dbplus) int le_dbplus_relation; int le_dbplus_tuple; -void dbplus_destruct_relation(zend_rsrc_list_entry *rsrc); -void dbplus_destruct_tupel(zend_rsrc_list_entry *rsrc); +void dbplus_destruct_relation(zend_rsrc_list_entry *rsrc TSRMLS_DC); +void dbplus_destruct_tupel(zend_rsrc_list_entry *rsrc TSRMLS_DC); #endif /* PHP_DBPLUS_H */ diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index b20ee61138..8eeccd12ef 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -348,7 +348,7 @@ static inline void node_list_wrapper_dtor(xmlNodePtr node) } } -static void php_free_xml_doc(zend_rsrc_list_entry *rsrc) +static void php_free_xml_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { xmlDoc *doc = (xmlDoc *)rsrc->ptr; @@ -360,7 +360,8 @@ static void php_free_xml_doc(zend_rsrc_list_entry *rsrc) } } -static void php_free_xml_node(zend_rsrc_list_entry *rsrc) { +static void php_free_xml_node(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ xmlNodePtr node = (xmlNodePtr) rsrc->ptr; if (node) { @@ -371,16 +372,17 @@ static void php_free_xml_node(zend_rsrc_list_entry *rsrc) { } #if defined(LIBXML_XPATH_ENABLED) -static void php_free_xpath_context(zend_rsrc_list_entry *rsrc) +static void php_free_xpath_context(zend_rsrc_list_entry *rsrc TSRMLS_DC) { xmlXPathContextPtr ctx = (xmlXPathContextPtr)rsrc->ptr; if(ctx) xmlXPathFreeContext(ctx); } -static void php_free_xpath_object(zend_rsrc_list_entry *rsrc) +static void php_free_xpath_object(zend_rsrc_list_entry *rsrc TSRMLS_DC) { xmlXPathObjectPtr obj = (xmlXPathObjectPtr)rsrc->ptr; + if(obj) xmlXPathFreeObject(obj); } diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c index 6cfbf67a28..f9c559b310 100644 --- a/ext/fbsql/php_fbsql.c +++ b/ext/fbsql/php_fbsql.c @@ -236,14 +236,13 @@ ZEND_GET_MODULE(fbsql) #define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"FrontBase: A link to the server could not be established"); RETURN_FALSE; } } -static void phpfbReleaseResult (zend_rsrc_list_entry *rsrc); -static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc); -static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc); +static void phpfbReleaseResult (zend_rsrc_list_entry *rsrc TSRMLS_DC); +static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc TSRMLS_DC); +static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc TSRMLS_DC); -static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc) +static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc TSRMLS_DC) { PHPFBResult* result = (PHPFBResult *)rsrc->ptr; - TSRMLS_FETCH(); if (result) { @@ -260,10 +259,9 @@ static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc) } -static void phpfbReleaseLink(zend_rsrc_list_entry *rsrc) +static void phpfbReleaseLink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { PHPFBLink* link = (PHPFBLink *)rsrc->ptr; - TSRMLS_FETCH(); if (link) { @@ -283,10 +281,9 @@ static void phpfbReleaseLink(zend_rsrc_list_entry *rsrc) } } -static void phpfbReleasePLink(zend_rsrc_list_entry *rsrc) +static void phpfbReleasePLink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { PHPFBLink* link = (PHPFBLink *)rsrc->ptr; - TSRMLS_FETCH(); if (link) { diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c index a5da77e67b..cbe7a1715d 100644 --- a/ext/fdf/fdf.c +++ b/ext/fdf/fdf.c @@ -83,9 +83,10 @@ ZEND_GET_MODULE(fdf) #endif -static void phpi_FDFClose(zend_rsrc_list_entry *rsrc) +static void phpi_FDFClose(zend_rsrc_list_entry *rsrc TSRMLS_DC) { FDFDoc fdf = (FDFDoc)rsrc->ptr; + (void) FDFClose(fdf); } diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 208a450695..36ac8d23bb 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -76,9 +76,10 @@ zend_module_entry php_ftp_module_entry = { ZEND_GET_MODULE(php_ftp) #endif -static void ftp_destructor_ftpbuf(zend_rsrc_list_entry *rsrc) +static void ftp_destructor_ftpbuf(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ftpbuf_t *ftp = (ftpbuf_t *)rsrc->ptr; + ftp_close(ftp); } diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 77ff9735f8..e866f57811 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -211,7 +211,7 @@ ZEND_GET_MODULE(gd) /* {{{ php_free_gd_image */ -static void php_free_gd_image(zend_rsrc_list_entry *rsrc) +static void php_free_gd_image(zend_rsrc_list_entry *rsrc TSRMLS_DC) { gdImageDestroy((gdImagePtr)rsrc->ptr); } @@ -219,9 +219,10 @@ static void php_free_gd_image(zend_rsrc_list_entry *rsrc) /* {{{ php_free_gd_font */ -static void php_free_gd_font(zend_rsrc_list_entry *rsrc) +static void php_free_gd_font(zend_rsrc_list_entry *rsrc TSRMLS_DC) { gdFontPtr fp = (gdFontPtr)rsrc->ptr; + if (fp->data) { efree(fp->data); } @@ -2756,9 +2757,10 @@ void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extende /* {{{ php_free_ps_font */ -void php_free_ps_font(zend_rsrc_list_entry *rsrc) +void php_free_ps_font(zend_rsrc_list_entry *rsrc TSRMLS_DC) { int *font = (int *)rsrc->ptr; + T1_DeleteFont(*font); efree(font); } @@ -2766,9 +2768,10 @@ void php_free_ps_font(zend_rsrc_list_entry *rsrc) /* {{{ php_free_ps_enc */ -void php_free_ps_enc(zend_rsrc_list_entry *rsrc) +void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { char **enc = (char **)rsrc->ptr; + T1_DeleteEncoding(enc); } /* }}} */ diff --git a/ext/gd/gdt1.h b/ext/gd/gdt1.h index cecb7eac4d..40b0b83641 100644 --- a/ext/gd/gdt1.h +++ b/ext/gd/gdt1.h @@ -23,8 +23,8 @@ #include <t1lib.h> -extern void php_free_ps_font(zend_rsrc_list_entry *rsrc); -extern void php_free_ps_enc(zend_rsrc_list_entry *rsrc); +extern void php_free_ps_font(zend_rsrc_list_entry *rsrc TSRMLS_DC); +extern void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC); #endif diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 1675093e3f..5fa7ce42dd 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -101,7 +101,7 @@ zend_module_entry gmp_module_entry = { ZEND_GET_MODULE(gmp) #endif -static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc); +static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC); #define GMP_RESOURCE_NAME "GMP integer" @@ -1195,9 +1195,10 @@ ZEND_FUNCTION(gmp_scan1) /* {{{ _php_gmpnum_free */ -static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc) +static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC) { mpz_t *gmpnum = (mpz_t *)rsrc->ptr; + FREE_GMP_NUM(gmpnum); } /* }}} */ diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c index 20df00487a..1f612b5281 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -148,10 +148,9 @@ ZEND_GET_MODULE(hw) void print_msg(hg_msg *msg, char *str, int txt); -void _close_hw_link(zend_rsrc_list_entry *rsrc) +void _close_hw_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { hw_connection *conn = (hw_connection *)rsrc->ptr; - TSRMLS_FETCH(); if(conn->hostname) free(conn->hostname); @@ -162,10 +161,9 @@ void _close_hw_link(zend_rsrc_list_entry *rsrc) HwSG(num_links)--; } -void _close_hw_plink(zend_rsrc_list_entry *rsrc) +void _close_hw_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { hw_connection *conn = (hw_connection *)rsrc->ptr; - TSRMLS_FETCH(); if(conn->hostname) free(conn->hostname); @@ -177,7 +175,7 @@ void _close_hw_plink(zend_rsrc_list_entry *rsrc) HwSG(num_persistent)--; } -void _free_hw_document(zend_rsrc_list_entry *rsrc) +void _free_hw_document(zend_rsrc_list_entry *rsrc TSRMLS_DC) { hw_document *doc = (hw_document *)rsrc->ptr; if(doc->data) diff --git a/ext/icap/php_icap.c b/ext/icap/php_icap.c index 7856ad6b89..9ff4ae3833 100644 --- a/ext/icap/php_icap.c +++ b/ext/icap/php_icap.c @@ -110,10 +110,11 @@ int le_picap; char icap_user[80]=""; char icap_password[80]=""; -CALSTREAM *cal_close_it (zend_rsrc_list_entry *rsrc) +CALSTREAM *cal_close_it (zend_rsrc_list_entry *rsrc TSRMLS_DC) { pils *icap_le_struct = (pils *)rsrc->ptr; CALSTREAM *ret; + ret = cal_close (icap_le_struct->icap_stream,0); efree(icap_le_struct); return ret; diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index e02d5d2274..0095e0348c 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -75,11 +75,11 @@ void *fs_get(size_t size); int imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char *rpath); -void mail_close_it (zend_rsrc_list_entry *rsrc); +void mail_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC); #ifdef OP_RELOGIN /* AJS: close persistent connection */ -void mail_userlogout_it(zend_rsrc_list_entry *rsrc); -void mail_nuke_chain(zend_rsrc_list_entry *rsrc); +void mail_userlogout_it(zend_rsrc_list_entry *rsrc TSRMLS_DC); +void mail_nuke_chain(zend_rsrc_list_entry *rsrc TSRMLS_DC); #endif /* {{{ imap_functions[] @@ -186,10 +186,9 @@ static int le_pimapchain; #endif -void mail_close_it(zend_rsrc_list_entry *rsrc) +void mail_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC) { pils *imap_le_struct = (pils *)rsrc->ptr; - TSRMLS_FETCH(); mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags); @@ -207,9 +206,10 @@ void mail_close_it(zend_rsrc_list_entry *rsrc) #ifdef OP_RELOGIN /* AJS: stream close functions for persistent connections */ -void mail_userlogout_it(zend_rsrc_list_entry *rsrc) +void mail_userlogout_it(zend_rsrc_list_entry *rsrc TSRMLS_DC) { pils *imap_le_struct = (pils *)rsrc->ptr; + /* Close this user's session, putting the stream back * into AUTHENTICATE state. (Note that IMAP does not * support this behavior... yet) @@ -218,7 +218,7 @@ void mail_userlogout_it(zend_rsrc_list_entry *rsrc) mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags | CL_HALF); } -void mail_nuke_chain(zend_rsrc_list_entry *rsrc) +void mail_nuke_chain(zend_rsrc_list_entry *rsrc TSRMLS_DC) { pils **headp = (pils **)rsrc->ptr; pils *node, *next; diff --git a/ext/ingres_ii/ii.c b/ext/ingres_ii/ii.c index ed931de2e5..c32ae42695 100644 --- a/ext/ingres_ii/ii.c +++ b/ext/ingres_ii/ii.c @@ -167,19 +167,19 @@ static void _close_ii_link(II_LINK *link) and releasing associated resources after rolling back the active transaction (if any) */ -static void php_close_ii_link(zend_rsrc_list_entry *rsrc) +static void php_close_ii_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { II_LINK *link = (II_LINK *)rsrc->ptr; + _close_ii_link(link); } /* closes the given persistent link, see _close_ii_link */ -static void _close_ii_plink(zend_rsrc_list_entry *rsrc) +static void _close_ii_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { II_LINK *link = (II_LINK *)rsrc->ptr; - TSRMLS_FETCH(); _close_ii_link(link); IIG(num_persistent)--; @@ -189,7 +189,7 @@ static void _close_ii_plink(zend_rsrc_list_entry *rsrc) used when the request ends to 'refresh' the link for use by the next request */ -static void _clean_ii_plink(zend_rsrc_list_entry *rsrc) +static void _clean_ii_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { II_LINK *link = (II_LINK *)rsrc->ptr; IIAPI_AUTOPARM autoParm; diff --git a/ext/ingres_ii/ii.h b/ext/ingres_ii/ii.h index ba31243942..3f50b77297 100644 --- a/ext/ingres_ii/ii.h +++ b/ext/ingres_ii/ii.h @@ -45,7 +45,7 @@ static int ii_success(IIAPI_GENPARM *genParm); static int _close_statement(II_LINK *link); static int _rollback_transaction(II_LINK *link); static void _close_ii_link(II_LINK *link); -static void _close_ii_plink(zend_rsrc_list_entry *link); +static void _close_ii_plink(zend_rsrc_list_entry *link TSRMLS_DC); static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS); static void php_ii_set_default_link(int id); static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent); diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index d8a76a0e9b..980ba90e01 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -328,17 +328,17 @@ static void _php_ibase_commit_link(ibase_db_link *link) } /* }}} */ -static void php_ibase_commit_link_rsrc(zend_rsrc_list_entry *rsrc) +static void php_ibase_commit_link_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ibase_db_link *link = (ibase_db_link *)rsrc->ptr; + _php_ibase_commit_link(link); } /* {{{ _php_ibase_close_link() */ -static void _php_ibase_close_link(zend_rsrc_list_entry *rsrc) +static void _php_ibase_close_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ibase_db_link *link = (ibase_db_link *)rsrc->ptr; - TSRMLS_FETCH(); _php_ibase_commit_link(link); IBDEBUG("Closing normal link..."); @@ -349,10 +349,9 @@ static void _php_ibase_close_link(zend_rsrc_list_entry *rsrc) /* }}} */ /* {{{ _php_ibase_close_plink() */ -static void _php_ibase_close_plink(zend_rsrc_list_entry *rsrc) +static void _php_ibase_close_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ibase_db_link *link = (ibase_db_link *)rsrc->ptr; - TSRMLS_FETCH(); _php_ibase_commit_link(link); IBDEBUG("Closing permanent link..."); @@ -364,10 +363,9 @@ static void _php_ibase_close_plink(zend_rsrc_list_entry *rsrc) /* }}} */ /* {{{ _php_ibase_free_result() */ -static void _php_ibase_free_result(zend_rsrc_list_entry *rsrc) +static void _php_ibase_free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ibase_result *ib_result = (ibase_result *)rsrc->ptr; - TSRMLS_FETCH(); IBDEBUG("Freeing result..."); if (ib_result){ @@ -427,17 +425,17 @@ static void _php_ibase_free_query(ibase_query *ib_query) } /* }}} */ -static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc) +static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ibase_query *query = (ibase_query *)rsrc->ptr; + _php_ibase_free_query(query); } /* {{{ _php_ibase_free_blob() */ -static void _php_ibase_free_blob(zend_rsrc_list_entry *rsrc) +static void _php_ibase_free_blob(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ibase_blob_handle *ib_blob = (ibase_blob_handle *)rsrc->ptr; - TSRMLS_FETCH(); if (ib_blob->bl_handle != NULL) { /* blob open*/ if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) { @@ -449,11 +447,10 @@ static void _php_ibase_free_blob(zend_rsrc_list_entry *rsrc) /* }}} */ /* {{{ _php_ibase_free_trans() */ -static void _php_ibase_free_trans(zend_rsrc_list_entry *rsrc) +static void _php_ibase_free_trans(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ibase_tr_link *ib_trans = (ibase_tr_link *)rsrc->ptr; ibase_db_link *ib_link; - TSRMLS_FETCH(); ib_link = (ibase_db_link *) zend_fetch_resource(NULL TSRMLS_CC, ib_trans->link_rsrc, "InterBase link", NULL, 2, le_link, le_plink); diff --git a/ext/java/java.c b/ext/java/java.c index fd9d77b2ae..be030e3f80 100644 --- a/ext/java/java.c +++ b/ext/java/java.c @@ -592,15 +592,17 @@ int java_set_property_handler /***************************************************************************/ -static void _php_java_destructor(zend_rsrc_list_entry *rsrc) +static void _php_java_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { void *jobject = (void *)rsrc->ptr; - JG_FETCH(); - if (JG(jenv)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), jobject); + + JG_FETCH(); + if (JG(jenv)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), jobject); } #ifdef ZTS -static void alloc_java_globals_ctor(php_java_globals *java_globals TSRMLS_DC) { +static void alloc_java_globals_ctor(php_java_globals *java_globals TSRMLS_DC) +{ memset(java_globals, 0, sizeof(php_java_globals)); } #endif diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 7b43f8e26f..2ef3c2d162 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -136,17 +136,16 @@ ZEND_GET_MODULE(ldap) #endif -static void _close_ldap_link(zend_rsrc_list_entry *rsrc) +static void _close_ldap_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { LDAP *ld = (LDAP *)rsrc->ptr; - TSRMLS_FETCH(); ldap_unbind_s(ld); LDAPG(num_links)--; } -static void _free_ldap_result(zend_rsrc_list_entry *rsrc) +static void _free_ldap_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { LDAPMessage *result = (LDAPMessage *)rsrc->ptr; ldap_msgfree(result); diff --git a/ext/mcal/php_mcal.c b/ext/mcal/php_mcal.c index c347217645..3e2958c5b6 100644 --- a/ext/mcal/php_mcal.c +++ b/ext/mcal/php_mcal.c @@ -45,7 +45,7 @@ #include "winsock.h" #endif -void cal_close_it(zend_rsrc_list_entry *rsrc); +void cal_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC); typedef struct _php_mcal_le_struct { CALSTREAM *mcal_stream; @@ -127,10 +127,11 @@ int le_mcal; char *mcal_user; char *mcal_password; -void cal_close_it (zend_rsrc_list_entry *rsrc) +void cal_close_it (zend_rsrc_list_entry *rsrc TSRMLS_DC) { pils *mcal_le_struct = (pils *)rsrc->ptr; - cal_close (mcal_le_struct->mcal_stream,0); + + cal_close(mcal_le_struct->mcal_stream,0); efree(mcal_le_struct); } diff --git a/ext/ming/ming.c b/ext/ming/ming.c index 6b4558b761..60a3ff8050 100644 --- a/ext/ming/ming.c +++ b/ext/ming/ming.c @@ -305,7 +305,7 @@ PHP_FUNCTION(swfbitmap_init) add_property_resource(getThis(), "bitmap", ret); zend_list_addref(ret); } -static void destroy_SWFBitmap_resource(zend_rsrc_list_entry *resource) +static void destroy_SWFBitmap_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFBitmap((SWFBitmap)resource->ptr); } @@ -377,7 +377,7 @@ PHP_FUNCTION(swfbutton_init) add_property_resource(getThis(), "button", ret); zend_list_addref(ret); } -static void destroy_SWFButton_resource(zend_rsrc_list_entry *resource) +static void destroy_SWFButton_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFButton((SWFButton)resource->ptr); } @@ -943,7 +943,7 @@ PHP_FUNCTION(swffill_init) { php_error(E_ERROR, "Instantiating SWFFill won't do any good- use SWFShape::addFill() instead!"); } -static void destroy_SWFFill_resource(zend_rsrc_list_entry *resource) +static void destroy_SWFFill_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { /* this only destroys the shallow wrapper for SWFFillStyle, which SWFShape destroys. So everything's okay. I hope. */ @@ -1126,7 +1126,7 @@ PHP_FUNCTION(swffont_init) add_property_resource(getThis(), "font", ret); zend_list_addref(ret); } -static void destroy_SWFFont_resource(zend_rsrc_list_entry *resource) +static void destroy_SWFFont_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFBlock((SWFBlock)resource->ptr); } @@ -1209,7 +1209,9 @@ PHP_FUNCTION(swfgradient_init) add_property_resource(getThis(), "gradient", ret); zend_list_addref(ret); } -static void destroy_SWFGradient_resource(zend_rsrc_list_entry *resource) + + +static void destroy_SWFGradient_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFGradient((SWFGradient)resource->ptr); } @@ -1288,7 +1290,9 @@ PHP_FUNCTION(swfmorph_init) add_property_resource(getThis(), "morph", ret); zend_list_addref(ret); } -static void destroy_SWFMorph_resource(zend_rsrc_list_entry *resource) + + +static void destroy_SWFMorph_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFMorph((SWFMorph)resource->ptr); } @@ -1385,7 +1389,9 @@ PHP_FUNCTION(swfmovie_init) add_property_resource(getThis(), "movie", ret); zend_list_addref(ret); } -static void destroy_SWFMovie_resource(zend_rsrc_list_entry *resource) + + +static void destroy_SWFMovie_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFMovie((SWFMovie)resource->ptr); } @@ -1691,7 +1697,9 @@ PHP_FUNCTION(swfshape_init) add_property_resource(getThis(), "shape", ret); zend_list_addref(ret); } -static void destroy_SWFShape_resource(zend_rsrc_list_entry *resource) + + +static void destroy_SWFShape_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFShape((SWFShape)resource->ptr); } @@ -2268,7 +2276,9 @@ PHP_FUNCTION(swfsprite_init) add_property_resource(getThis(), "sprite", ret); zend_list_addref(ret); } -static void destroy_SWFSprite_resource(zend_rsrc_list_entry *resource) + + +static void destroy_SWFSprite_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFMovieClip((SWFMovieClip)resource->ptr); } @@ -2412,7 +2422,9 @@ PHP_FUNCTION(swftext_init) add_property_resource(getThis(), "text", ret); zend_list_addref(ret); } -static void destroy_SWFText_resource(zend_rsrc_list_entry *resource) + + +static void destroy_SWFText_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFText((SWFText)resource->ptr); } @@ -2658,7 +2670,9 @@ PHP_FUNCTION(swftextfield_init) SWFTextField_setFlags(field, Z_LVAL_PP(flags)); } } -static void destroy_SWFTextField_resource(zend_rsrc_list_entry *resource) + + +static void destroy_SWFTextField_resource(zend_rsrc_list_entry *resource TSRMLS_DC) { destroySWFTextField((SWFTextField)resource->ptr); } diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c index 56f0f4faf0..9efe54cbc7 100644 --- a/ext/mnogosearch/php_mnogo.c +++ b/ext/mnogosearch/php_mnogo.c @@ -160,13 +160,15 @@ zend_module_entry mnogosearch_module_entry = { ZEND_GET_MODULE(mnogosearch) #endif -static void _free_udm_agent(zend_rsrc_list_entry *rsrc){ +static void _free_udm_agent(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ UDM_AGENT * Agent = (UDM_AGENT *)rsrc->ptr; UdmFreeEnv(Agent->Conf); UdmFreeAgent(Agent); } -static void _free_udm_res(zend_rsrc_list_entry *rsrc){ +static void _free_udm_res(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ UDM_RESULT * Res = (UDM_RESULT *)rsrc->ptr; UdmFreeResult(Res); } diff --git a/ext/msql/php_msql.c b/ext/msql/php_msql.c index bca3243b0f..34eb5526fe 100644 --- a/ext/msql/php_msql.c +++ b/ext/msql/php_msql.c @@ -121,7 +121,7 @@ typedef struct { ZEND_FETCH_RESOURCE(msql_query, m_query *, &res, -1, "mSQL result", msql_globals.le_query); \ msql_result = msql_query->result -static void _delete_query(zend_rsrc_list_entry *rsrc) +static void _delete_query(zend_rsrc_list_entry *rsrc TSRMLS_DC) { m_query *query = (m_query *)rsrc->ptr; @@ -139,17 +139,19 @@ static m_query *php_msql_query_wrapper(m_result *res, int af_rows) return query; } -static void _close_msql_link(zend_rsrc_list_entry *rsrc) +static void _close_msql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { int link = (int)rsrc->ptr; + msqlClose(link); msql_globals.num_links--; } -static void _close_msql_plink(zend_rsrc_list_entry *rsrc) +static void _close_msql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { int link = (int)rsrc->ptr; + msqlClose(link); msql_globals.num_persistent--; msql_globals.num_links--; diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 1afc79bf53..957e4d9c47 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -206,9 +206,10 @@ static void _free_mssql_statement(mssql_statement *statement) efree(statement); } -static void _free_mssql_result(zend_rsrc_list_entry *rsrc) +static void _free_mssql_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { mssql_result *result = (mssql_result *)rsrc->ptr; + _free_result(result, 1); efree(result); } @@ -222,10 +223,9 @@ static void php_mssql_set_default_link(int id TSRMLS_DC) zend_list_addref(id); } -static void _close_mssql_link(zend_rsrc_list_entry *rsrc) +static void _close_mssql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { mssql_link *mssql_ptr = (mssql_link *)rsrc->ptr; - TSRMLS_FETCH(); mssql_ptr->valid = 0; zend_hash_apply(&EG(regular_list),(apply_func_t) _clean_invalid_results TSRMLS_CC); @@ -236,10 +236,9 @@ static void _close_mssql_link(zend_rsrc_list_entry *rsrc) } -static void _close_mssql_plink(zend_rsrc_list_entry *rsrc) +static void _close_mssql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { mssql_link *mssql_ptr = (mssql_link *)rsrc->ptr; - TSRMLS_FETCH(); dbclose(mssql_ptr->link); dbfreelogin(mssql_ptr->login); diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index f589c5cd6d..42c8b793f9 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -201,7 +201,7 @@ void timeout(int sig); * This wrapper is required since mysql_free_result() returns an integer, and * thus, cannot be used directly */ -static void _free_mysql_result(zend_rsrc_list_entry *rsrc) +static void _free_mysql_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { MYSQL_RES *mysql_result = (MYSQL_RES *)rsrc->ptr; @@ -223,11 +223,10 @@ static void php_mysql_set_default_link(int id TSRMLS_DC) /* {{{ _close_mysql_link */ -static void _close_mysql_link(zend_rsrc_list_entry *rsrc) +static void _close_mysql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr; void (*handler) (int); - TSRMLS_FETCH(); handler = signal(SIGPIPE, SIG_IGN); mysql_close(&link->conn); @@ -239,11 +238,10 @@ static void _close_mysql_link(zend_rsrc_list_entry *rsrc) /* {{{ _close_mysql_plink */ -static void _close_mysql_plink(zend_rsrc_list_entry *rsrc) +static void _close_mysql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr; void (*handler) (int); - TSRMLS_FETCH(); handler = signal(SIGPIPE, SIG_IGN); mysql_close(&link->conn); diff --git a/ext/ncurses/ncurses.c b/ext/ncurses/ncurses.c index 741fa9cb3a..2b7b28c31d 100644 --- a/ext/ncurses/ncurses.c +++ b/ext/ncurses/ncurses.c @@ -34,7 +34,8 @@ ZEND_DECLARE_MODULE_GLOBALS(ncurses) int le_ncurses; -static void ncurses_destruct(zend_rsrc_list_entry *rsrc) { +static void ncurses_destruct(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ WINDOW **pwin = (WINDOW **)rsrc->ptr; delwin(*pwin); diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index f84e2f0153..593ea10ab0 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -131,14 +131,14 @@ static int oci_ping(oci_server *server); static void oci_debug(const char *format, ...); static void _oci_conn_list_dtor(oci_connection *connection); -static void _oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc); -static void _oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc); +static void _oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); +static void _oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); #ifdef WITH_COLLECTIONS -static void _oci_coll_list_dtor(zend_rsrc_list_entry *rsrc); +static void _oci_coll_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); #endif -static void _oci_server_list_dtor(zend_rsrc_list_entry *rsrc); -static void _oci_session_list_dtor(zend_rsrc_list_entry *rsrc); -static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc); +static void _oci_server_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); +static void _oci_session_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); +static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc TSRMLS_DC); static void _oci_column_hash_dtor(void *data); static void _oci_define_hash_dtor(void *data); @@ -687,7 +687,7 @@ _oci_column_hash_dtor(void *data) /* {{{ _oci_stmt_list_dtor() */ static void -_oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc) +_oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { oci_statement *statement = (oci_statement *)rsrc->ptr; oci_debug("START _oci_stmt_list_dtor: id=%d last_query=\"%s\"",statement->id,SAFE_STRING(statement->last_query)); @@ -772,7 +772,7 @@ _oci_conn_list_dtor(oci_connection *connection) /* {{{ php_oci_free_conn_list */ -static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc) +static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc TSRMLS_DC) { oci_connection *conn = (oci_connection *)rsrc->ptr; _oci_conn_list_dtor(conn); @@ -785,7 +785,7 @@ static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc) */ static void -_oci_coll_list_dtor(zend_rsrc_list_entry *rsrc) +_oci_coll_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { oci_collection *coll = (oci_collection *)rsrc->ptr; oci_debug("START _oci_coll_list_dtor: %d",coll->id); @@ -806,7 +806,7 @@ _oci_coll_list_dtor(zend_rsrc_list_entry *rsrc) */ static void -_oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc) +_oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { oci_descriptor *descr = (oci_descriptor *)rsrc->ptr; oci_debug("START _oci_descriptor_list_dtor: %d",descr->id); @@ -825,7 +825,7 @@ _oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc) */ static void -_oci_server_list_dtor(zend_rsrc_list_entry *rsrc) +_oci_server_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { oci_server *server = (oci_server *)rsrc->ptr; if (server->persistent) @@ -839,7 +839,7 @@ _oci_server_list_dtor(zend_rsrc_list_entry *rsrc) */ static void -_oci_session_list_dtor(zend_rsrc_list_entry *rsrc) +_oci_session_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { oci_session *session = (oci_session *)rsrc->ptr; if (session->persistent) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 82c2af0569..4983058587 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -158,7 +158,7 @@ ZEND_GET_MODULE(odbc) /* {{{ _free_odbc_result */ -static void _free_odbc_result(zend_rsrc_list_entry *rsrc) +static void _free_odbc_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { odbc_result *res = (odbc_result *)rsrc->ptr; int i; @@ -206,12 +206,10 @@ static void safe_odbc_disconnect( void *handle ) /* {{{ _close_odbc_conn */ -static void _close_odbc_conn(zend_rsrc_list_entry *rsrc) +static void _close_odbc_conn(zend_rsrc_list_entry *rsrc TSRMLS_DC) { odbc_connection *conn = (odbc_connection *)rsrc->ptr; - TSRMLS_FETCH(); - safe_odbc_disconnect(conn->hdbc); SQLFreeConnect(conn->hdbc); SQLFreeEnv(conn->henv); @@ -220,10 +218,9 @@ static void _close_odbc_conn(zend_rsrc_list_entry *rsrc) } /* }}} */ -static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc) +static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc TSRMLS_DC) { odbc_connection *conn = (odbc_connection *)rsrc->ptr; - TSRMLS_FETCH(); safe_odbc_disconnect(conn->hdbc); SQLFreeConnect(conn->hdbc); diff --git a/ext/odbc/velocis.c b/ext/odbc/velocis.c index 5d47f0edb4..b9e8888ae0 100644 --- a/ext/odbc/velocis.c +++ b/ext/odbc/velocis.c @@ -77,17 +77,19 @@ ZEND_GET_MODULE(velocis) THREAD_LS velocis_module php_velocis_module; THREAD_LS static HENV henv; -static void _close_velocis_link(zend_rsrc_list_entry *rsrc) +static void _close_velocis_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { VConn *conn = (VConn *)rsrc->ptr; + if ( conn ) { efree(conn); } } -static void _free_velocis_result(zend_rsrc_list_entry *rsrc) +static void _free_velocis_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { Vresult *res = (Vresult *)rsrc->ptr; + if ( res && res->values ) { register int i; for ( i=0; i < res->numcols; i++ ) { diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index c4ac6e6ffb..d34bca6d99 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -97,10 +97,10 @@ zend_module_entry openssl_module_entry = { ZEND_GET_MODULE(openssl) #endif -static void _php_pkey_free(zend_rsrc_list_entry *rsrc); +static void _php_pkey_free(zend_rsrc_list_entry *rsrc TSRMLS_DC); static int le_key; -static void _php_x509_free(zend_rsrc_list_entry *rsrc); +static void _php_x509_free(zend_rsrc_list_entry *rsrc TSRMLS_DC); static int le_x509; static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * resourceval); @@ -1856,7 +1856,7 @@ PHP_FUNCTION(openssl_open) /* }}} */ /* {{{ _php_pkey_free() */ -static void _php_pkey_free(zend_rsrc_list_entry *rsrc) +static void _php_pkey_free(zend_rsrc_list_entry *rsrc TSRMLS_DC) { EVP_PKEY *pkey = (EVP_PKEY *)rsrc->ptr; EVP_PKEY_free(pkey); @@ -1864,7 +1864,7 @@ static void _php_pkey_free(zend_rsrc_list_entry *rsrc) /* }}} */ /* {{{ _php_x509_free() */ -static void _php_x509_free(zend_rsrc_list_entry *rsrc) +static void _php_x509_free(zend_rsrc_list_entry *rsrc TSRMLS_DC) { X509 *x509 = (X509 *)rsrc->ptr; X509_free(x509); diff --git a/ext/oracle/oracle.c b/ext/oracle/oracle.c index 10e86b9726..c076c7abc4 100644 --- a/ext/oracle/oracle.c +++ b/ext/oracle/oracle.c @@ -71,7 +71,7 @@ PHP_ORA_API php_ora_globals ora_globals; static oraCursor *ora_get_cursor(HashTable *, pval **); static char *ora_error(Cda_Def *); static int ora_describe_define(oraCursor *); -static int _close_oraconn(zend_rsrc_list_entry *rsrc); +static int _close_oraconn(zend_rsrc_list_entry *rsrc TSRMLS_DC); static int _close_oracur(oraCursor *cur); static int _ora_ping(oraConnection *conn); int ora_set_param_values(oraCursor *cursor, int isout); @@ -201,10 +201,9 @@ ZEND_GET_MODULE(oracle) /* {{{ _close_oraconn */ -static int _close_oraconn(zend_rsrc_list_entry *rsrc) +static int _close_oraconn(zend_rsrc_list_entry *rsrc TSRMLS_DC) { oraConnection *conn = (oraConnection *)rsrc->ptr; - TSRMLS_FETCH(); conn->open = 0; @@ -277,7 +276,7 @@ static int _close_oracur(oraCursor *cur) /* {{{ php_close_ora_cursor */ -static void php_close_ora_cursor(zend_rsrc_list_entry *rsrc) +static void php_close_ora_cursor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { oraCursor *cur = (oraCursor *)rsrc->ptr; _close_oracur(cur); diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c index 599416bc00..cb5c198af1 100644 --- a/ext/pdf/pdf.c +++ b/ext/pdf/pdf.c @@ -253,7 +253,7 @@ ZEND_GET_MODULE(pdf) /* {{{ _free_pdf_doc */ -static void _free_pdf_doc(zend_rsrc_list_entry *rsrc) +static void _free_pdf_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { /* RJS: TODO: PDF *pdf = (PDF *)rsrc->ptr; diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index bbd5cfdf06..8ff51b8968 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -142,10 +142,9 @@ static void php_pgsql_set_default_link(int id) /* {{{ _close_pgsql_link */ -static void _close_pgsql_link(zend_rsrc_list_entry *rsrc) +static void _close_pgsql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { PGconn *link = (PGconn *)rsrc->ptr; - TSRMLS_FETCH(); PQfinish(link); PGG(num_links)--; @@ -154,10 +153,9 @@ static void _close_pgsql_link(zend_rsrc_list_entry *rsrc) /* {{{ _close_pgsql_plink */ -static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc) +static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { PGconn *link = (PGconn *)rsrc->ptr; - TSRMLS_FETCH(); PQfinish(link); PGG(num_persistent)--; @@ -206,7 +204,7 @@ static int _rollback_transactions(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ _free_ptr */ -static void _free_ptr(zend_rsrc_list_entry *rsrc) +static void _free_ptr(zend_rsrc_list_entry *rsrc TSRMLS_DC) { pgLofp *lofp = (pgLofp *)rsrc->ptr; efree(lofp); @@ -215,9 +213,10 @@ static void _free_ptr(zend_rsrc_list_entry *rsrc) /* {{{ _free_result */ -static void _free_result(zend_rsrc_list_entry *rsrc) +static void _free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { pgsql_result_handle *pg_result = (pgsql_result_handle *)rsrc->ptr; + PQclear(pg_result->result); efree(pg_result); } diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index 76534e5710..fec700adb8 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -78,15 +78,17 @@ zend_module_entry pspell_module_entry = { ZEND_GET_MODULE(pspell) #endif -static void php_pspell_close(zend_rsrc_list_entry *rsrc) +static void php_pspell_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) { PspellManager *manager = (PspellManager *)rsrc->ptr; + delete_pspell_manager(manager); } -static void php_pspell_close_config(zend_rsrc_list_entry *rsrc) +static void php_pspell_close_config(zend_rsrc_list_entry *rsrc TSRMLS_DC) { PspellConfig *config = (PspellConfig *)rsrc->ptr; + delete_pspell_config(config); } diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c index a9d18cec9f..cb60f4d2a8 100644 --- a/ext/rpc/com/com_wrapper.c +++ b/ext/rpc/com/com_wrapper.c @@ -335,9 +335,10 @@ static char *php_string_from_clsid(const CLSID *clsid) return clsid_str; } -static void php_comval_destructor(zend_rsrc_list_entry *rsrc) +static void php_comval_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { comval *obj = (comval *)rsrc->ptr; + if(C_ISREFD(obj)) { C_REFCOUNT(obj) = 1; diff --git a/ext/rpc/com/variant.c b/ext/rpc/com/variant.c index af435bacbd..8f9ebd0e2d 100644 --- a/ext/rpc/com/variant.c +++ b/ext/rpc/com/variant.c @@ -42,7 +42,7 @@ void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_proper pval php_VARIANT_get_property_handler(zend_property_reference *property_reference); static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value); void php_register_VARIANT_class(); -static void php_variant_destructor(zend_rsrc_list_entry *rsrc); +static void php_variant_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC); void php_register_VARIANT_class(); static int le_variant; @@ -423,7 +423,7 @@ static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value) return SUCCESS; } -static void php_variant_destructor(zend_rsrc_list_entry *rsrc) +static void php_variant_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { efree(rsrc); } diff --git a/ext/rpc/java/java.c b/ext/rpc/java/java.c index fd9d77b2ae..be030e3f80 100644 --- a/ext/rpc/java/java.c +++ b/ext/rpc/java/java.c @@ -592,15 +592,17 @@ int java_set_property_handler /***************************************************************************/ -static void _php_java_destructor(zend_rsrc_list_entry *rsrc) +static void _php_java_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { void *jobject = (void *)rsrc->ptr; - JG_FETCH(); - if (JG(jenv)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), jobject); + + JG_FETCH(); + if (JG(jenv)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), jobject); } #ifdef ZTS -static void alloc_java_globals_ctor(php_java_globals *java_globals TSRMLS_DC) { +static void alloc_java_globals_ctor(php_java_globals *java_globals TSRMLS_DC) +{ memset(java_globals, 0, sizeof(php_java_globals)); } #endif diff --git a/ext/sablot/sablot.c b/ext/sablot/sablot.c index d5b856d716..f3b3f8520d 100644 --- a/ext/sablot/sablot.c +++ b/ext/sablot/sablot.c @@ -38,7 +38,7 @@ static int le_sablot; /* Functions related to PHP's list handling */ -static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc); +static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC); /* SAX Handlers */ static void _php_sablot_handler_pair(php_sablot *, zval **, zval **, zval **); @@ -1570,9 +1570,10 @@ static int _php_sablot_sh_close(void *userData, SablotHandle p, int handle) /* {{{ _php_sablot_free_processor() Free a Sablot handle */ -static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc) +static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_sablot *handle = (php_sablot *)rsrc->ptr; + if (handle->p) { SablotUnregHandler(handle->p, HLR_MESSAGE, NULL, NULL); SablotUnregHandler(handle->p, HLR_SAX, NULL, NULL); diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index ed7e39416b..42ccf66dbc 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -73,7 +73,7 @@ ZEND_GET_MODULE(shmop) /* {{{ rsclean */ -static void rsclean(zend_rsrc_list_entry *rsrc) +static void rsclean(zend_rsrc_list_entry *rsrc TSRMLS_DC) { struct php_shmop *shmop = (struct php_shmop *)rsrc->ptr; diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index d4ded35d70..8e18d28697 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -173,13 +173,14 @@ ZEND_GET_MODULE(sockets) /* inet_ntop should be used instead of inet_ntoa */ int inet_ntoa_lock = 0; -static void destroy_fd_sets(zend_rsrc_list_entry *rsrc) +static void destroy_fd_sets(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_fd_set *php_fd = (php_fd_set*)rsrc->ptr; + efree(php_fd); } -static void destroy_iovec(zend_rsrc_list_entry *rsrc) +static void destroy_iovec(zend_rsrc_list_entry *rsrc TSRMLS_DC) { unsigned int i; php_iovec_t *iov = (php_iovec_t *) rsrc->ptr; @@ -194,7 +195,7 @@ static void destroy_iovec(zend_rsrc_list_entry *rsrc) } } -static void destroy_socket(zend_rsrc_list_entry *rsrc) +static void destroy_socket(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_socket *php_sock = (php_socket *) rsrc->ptr; diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 32bbaf9698..f691e6e307 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -101,9 +101,10 @@ static void php_set_default_dir(int id TSRMLS_DC) } -static void _dir_dtor(zend_rsrc_list_entry *rsrc) +static void _dir_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_dir *dirp = (php_dir *)rsrc->ptr; + closedir(dirp->dir); efree(dirp); } diff --git a/ext/standard/file.c b/ext/standard/file.c index b03911f897..107bc67abf 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -112,18 +112,18 @@ static int le_stream = FAILURE; /* }}} */ /* {{{ Module-Stuff */ -static void _file_popen_dtor(zend_rsrc_list_entry *rsrc) +static void _file_popen_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { FILE *pipe = (FILE *)rsrc->ptr; - TSRMLS_FETCH(); FG(pclose_ret) = pclose(pipe); } -static void _file_socket_dtor(zend_rsrc_list_entry *rsrc) +static void _file_socket_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { int *sock = (int *)rsrc->ptr; + SOCK_FCLOSE(*sock); #if HAVE_SHUTDOWN shutdown(*sock, 0); @@ -132,9 +132,10 @@ static void _file_socket_dtor(zend_rsrc_list_entry *rsrc) } #if HAVE_PHP_STREAM -static void _file_stream_dtor(zend_rsrc_list_entry * rsrc) +static void _file_stream_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - php_stream * stream = (php_stream*)rsrc->ptr; + php_stream *stream = (php_stream*)rsrc->ptr; + php_stream_close(stream); } #endif @@ -144,9 +145,10 @@ PHPAPI int php_file_le_stream(void) return le_stream; } -static void _file_fopen_dtor(zend_rsrc_list_entry *rsrc) +static void _file_fopen_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { FILE *fp = (FILE *)rsrc->ptr; + fclose(fp); } diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c index 7fc514a883..e86f5bd012 100644 --- a/ext/sybase/php_sybase_db.c +++ b/ext/sybase/php_sybase_db.c @@ -138,7 +138,7 @@ static int _clean_invalid_results(list_entry *le TSRMLS_DC) } -static void _free_sybase_result(zend_rsrc_list_entry *rsrc) +static void _free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { sybase_result *result = (sybase_result *)rsrc->ptr; int i,j; @@ -164,10 +164,9 @@ static void _free_sybase_result(zend_rsrc_list_entry *rsrc) } -static void _close_sybase_link(zend_rsrc_list_entry *rsrc) +static void _close_sybase_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr; - TSRMLS_FETCH(); sybase_ptr->valid = 0; @@ -185,9 +184,10 @@ static void _close_sybase_link(zend_rsrc_list_entry *rsrc) } -static void _close_sybase_plink(zend_rsrc_list_entry *rsrc) +static void _close_sybase_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr; + dbclose(sybase_ptr->link); dbloginfree(sybase_ptr->login); free(sybase_ptr); diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index dfb04f36c1..ff1df90f4a 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -133,17 +133,17 @@ static void _free_sybase_result(sybase_result *result) efree(result); } -static void php_free_sybase_result(zend_rsrc_list_entry *rsrc) +static void php_free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { sybase_result *result = (sybase_result *)rsrc->ptr; + _free_sybase_result(result); } -static void _close_sybase_link(zend_rsrc_list_entry *rsrc) +static void _close_sybase_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) { sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr; CS_INT con_status; - TSRMLS_FETCH(); sybase_ptr->valid = 0; @@ -171,11 +171,10 @@ static void _close_sybase_link(zend_rsrc_list_entry *rsrc) } -static void _close_sybase_plink(zend_rsrc_list_entry *rsrc) +static void _close_sybase_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) { sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr; CS_INT con_status; - TSRMLS_FETCH(); /* Persistent connections may have been closed before a failed * reopen attempt. diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c index 8f0f5e3b1b..186a1d11a9 100644 --- a/ext/sysvsem/sysvsem.c +++ b/ext/sysvsem/sysvsem.c @@ -102,7 +102,7 @@ THREAD_LS sysvsem_module php_sysvsem_module; /* {{{ release_sysvsem_sem */ -static void release_sysvsem_sem(zend_rsrc_list_entry *rsrc) +static void release_sysvsem_sem(zend_rsrc_list_entry *rsrc TSRMLS_DC) { sysvsem_sem *sem_ptr = (sysvsem_sem *)rsrc->ptr; struct sembuf sop[2]; diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index 999d95ce0d..174e9f0301 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -71,7 +71,7 @@ THREAD_LS sysvshm_module php_sysvshm; /* {{{ php_release_sysvshm */ -static void php_release_sysvshm(zend_rsrc_list_entry *rsrc) +static void php_release_sysvshm(zend_rsrc_list_entry *rsrc) { sysvshm_shm *shm_ptr = (sysvshm_shm *)rsrc->ptr; shmdt((void*)shm_ptr->ptr); diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 4847cecb1c..204f043201 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -200,7 +200,7 @@ static int wddx_stack_destroy(wddx_stack *stack) /* {{{ release_wddx_packet_rsrc */ -static void release_wddx_packet_rsrc(zend_rsrc_list_entry *rsrc) +static void release_wddx_packet_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { smart_str *str = (smart_str *)rsrc->ptr; smart_str_free(str); diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 74beeb9b3c..ebb14f6a93 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -74,7 +74,7 @@ PHP_MSHUTDOWN_FUNCTION(xml); PHP_RSHUTDOWN_FUNCTION(xml); PHP_MINFO_FUNCTION(xml); -static void xml_parser_dtor(zend_rsrc_list_entry *rsrc); +static void xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); static void xml_set_handler(zval **, zval **); inline static unsigned short xml_encode_iso_8859_1(unsigned char); inline static char xml_decode_iso_8859_1(unsigned short); @@ -288,7 +288,7 @@ static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encod /* {{{ xml_parser_dtor() */ static void -xml_parser_dtor(zend_rsrc_list_entry *rsrc) +xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { xml_parser *parser = (xml_parser *)rsrc->ptr; diff --git a/ext/xslt/sablot.c b/ext/xslt/sablot.c index d71cd5401c..b9237da90f 100644 --- a/ext/xslt/sablot.c +++ b/ext/xslt/sablot.c @@ -41,7 +41,7 @@ static void register_sax_handler_pair(zval *, zval *, zval **); /* Free processor */ -static void free_processor(zend_rsrc_list_entry *); +static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC); /* Scheme handler functions */ static int scheme_getall(void *, SablotHandle, const char *, const char *, char **, int *); @@ -602,7 +602,7 @@ PHP_FUNCTION(xslt_free) /* {{{ free_processor() Free an XSLT processor */ -static void free_processor(zend_rsrc_list_entry *rsrc) +static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_xslt *handle = (php_xslt *) rsrc->ptr; /* A PHP-XSLT processor */ diff --git a/ext/zip/zip.c b/ext/zip/zip.c index c35258e907..046083ae98 100644 --- a/ext/zip/zip.c +++ b/ext/zip/zip.c @@ -73,16 +73,17 @@ ZEND_GET_MODULE(zip) /* {{{ php_zip_free_dir */ -static void php_zip_free_dir(zend_rsrc_list_entry *rsrc) +static void php_zip_free_dir(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ZZIP_DIR *z_dir = (ZZIP_DIR *) rsrc->ptr; + zzip_closedir(z_dir); } /* }}} */ /* {{{ php_zip_free_entry */ -static void php_zip_free_entry(zend_rsrc_list_entry *rsrc) +static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_zzip_dirent *entry = (php_zzip_dirent *) rsrc->ptr; diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 92a5d347ac..112d745af9 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -133,9 +133,10 @@ PHP_INI_END() /* {{{ phpi_destructor_gzclose */ -static void phpi_destructor_gzclose(zend_rsrc_list_entry *rsrc) +static void phpi_destructor_gzclose(zend_rsrc_list_entry *rsrc TSRMLS_DC) { gzFile *zp = (gzFile *)rsrc->ptr; + (void)gzclose(zp); } /* }}} */ |