cvs commit

From: Date: Mon, 12 Jul 1999 06:34:37 +0000
Subject: cvs commit
Groups: php.dev 
Request: Send a blank email to php-dev+get-8381@lists.php.net to get a copy of this message
From: thies Date: Mon Jul 12 06:34:37 1999 Modified files: php3/functions/oci8.c Log message: destructor fixes Index: php3/functions/oci8.c diff -u php3/functions/oci8.c:1.113 php3/functions/oci8.c:1.114 --- php3/functions/oci8.c:1.113 Thu Jul 8 10:02:54 1999 +++ php3/functions/oci8.c Mon Jul 12 06:34:36 1999 @@ -33,7 +33,7 @@ #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */ -/* $Id: oci8.c,v 1.113 1999/07/08 14:02:54 thies Exp $ */ +/* $Id: oci8.c,v 1.114 1999/07/12 10:34:36 thies Exp $ */ /* TODO list: * @@ -71,9 +71,11 @@ #include "internal_functions.h" #include "php3_list.h" #include "head.h" + #define HASH_DTOR (void (*)(void *)) #else #include "ext/standard/head.h" #define php3tls_pval_destructor(a) zval_dtor(a) + #define HASH_DTOR (int (*)(void *)) #endif @@ -174,7 +176,7 @@ static void _oci8_close_conn(oci8_connection *connection); static void _oci8_free_stmt(oci8_statement *statement); static void _oci8_free_column(oci8_out_column *column); -static void _oci8_free_descr(oci8_descriptor *descr); +static int _oci8_free_descr(oci8_descriptor *descr); static oci8_connection *oci8_get_conn(int, const char *, HashTable *); static oci8_statement *oci8_get_stmt(int, const char *, HashTable *); @@ -592,7 +594,7 @@ efree(define->name); define->name = 0; } - return 0; + return 1; } /* }}} */ @@ -888,7 +890,9 @@ oci8_debug("oci8_make_pval: %16s,retlen = %4d,cb_retlen = %d,storage_size4 = %4d,indicator %4d, retcode = %4d", column->name,column->retlen,column->cb_retlen,column->storage_size4,column->indicator,column->retcode); +/* memset(value,0,sizeof(pval)); +*/ if (column->indicator == -1) { /* column is NULL */ var_reset(value); /* XXX we NEED to make sure that there's no data attached to this yet!!! */ @@ -1112,7 +1116,7 @@ statement->columns = emalloc(sizeof(HashTable)); if (!statement->columns || - _php3_hash_init(statement->columns, 13, NULL,(void (*)(void *))_oci8_free_column, 0) == FAILURE) { + _php3_hash_init(statement->columns, 13, NULL,HASH_DTOR _oci8_free_column, 0) == FAILURE) { /* out of memory */ return 0; } @@ -1423,7 +1427,7 @@ if (! column->define) { continue; } - + php3tls_pval_destructor(column->define->pval); oci8_make_pval(column->define->pval,statement,column,"OCIFetch",0); @@ -1994,7 +1998,7 @@ /* {{{ _oci8_free_descr() */ -static void +static int _oci8_free_descr(oci8_descriptor *descr) { OCI8_TLS_VARS; @@ -2002,6 +2006,8 @@ oci8_debug("oci8_free_descr: %x",descr->ocidescr); OCIDescriptorFree(descr->ocidescr, descr->type); + + return 1; } /* }}} */ /* {{{ oci8_open_server() @@ -2285,7 +2291,7 @@ connection->descriptors = emalloc(sizeof(HashTable)); if (!connection->descriptors || - _php3_hash_init(connection->descriptors, 13, NULL,(void (*)(void *))_oci8_free_descr, 0) == FAILURE) { + _php3_hash_init(connection->descriptors, 13, NULL,HASH_DTOR _oci8_free_descr, 0) == FAILURE) { goto CLEANUP; } @@ -2348,7 +2354,7 @@ if (statement->defines == NULL) { statement->defines = emalloc(sizeof(HashTable)); if (statement->defines == NULL || - _php3_hash_init(statement->defines, 13, NULL, (void (*)(void *))oci8_free_define, 0) == FAILURE) { + _php3_hash_init(statement->defines, 13, NULL,HASH_DTOR oci8_free_define, 0) == FAILURE) { /* out of memory */ RETURN_FALSE; } @@ -3166,15 +3172,13 @@ #if PHP_API_VERSION >= 19990421 element = emalloc(sizeof(pval)); - element->is_ref=0; - element->refcount=1; #endif if ((mode & OCI_NUM) || (! (mode & OCI_ASSOC))) { /* OCI_NUM is default */ oci8_make_pval(element,statement,column, "OCIFetchInto",mode); + #if PHP_API_VERSION >= 19990421 - element->is_ref = 0; - element->refcount = 1; + INIT_PZVAL(element); _php3_hash_index_update(array->value.ht, i, (void *)&element, sizeof(pval*), NULL); #else _php3_hash_index_update(array->value.ht, i, (void *)element, sizeof(pval), NULL); @@ -3185,6 +3189,7 @@ oci8_make_pval(element,statement,column, "OCIFetchInto",mode); #if PHP_API_VERSION >= 19990421 + INIT_PZVAL(element); _php3_hash_update(array->value.ht, column->name, column->name_len+1, (void *)&element, sizeof(pval*), NULL); #else _php3_hash_update(array->value.ht, column->name, column->name_len+1, (void *)element, sizeof(pval), NULL); @@ -3257,15 +3262,13 @@ #if PHP_API_VERSION >= 19990421 tmp = emalloc(sizeof(pval)); - tmp->is_ref = 0; - tmp->refcount = 1; + INIT_PZVAL(tmp); #endif array_init(tmp); #if PHP_API_VERSION >= 19990421 - tmp->is_ref = 0; - tmp->refcount = 1; + INIT_PZVAL(tmp); #endif memcpy(namebuf,columns[ i ]->name, columns[ i ]->name_len); @@ -3297,8 +3300,7 @@ #if PHP_API_VERSION < 19990421 _php3_hash_index_update(outarrs[ i ]->value.ht, rows, (void *)element, sizeof(pval), NULL); #else - element->refcount = 1; - element->is_ref = 0; + INIT_PZVAL(element); _php3_hash_index_update((*(outarrs[ i ]))->value.ht, rows, (void *)&element, sizeof(pval*), NULL); #endif }

« previous php.dev (#8381) next »