CVS update: php3/functions

From: Date: Mon, 10 May 1999 11:52:05 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5475@lists.php.net to get a copy of this message
Date: Monday May 10, 1999 @ 7:52 Author: sas Update of /repository/php3/functions In directory php:/tmp/cvs-serv26408/functions Modified Files: dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c dba_ndbm.c Log Message: final cleanup of the DBA module Index: php3/functions/dba.c diff -u php3/functions/dba.c:1.13 php3/functions/dba.c:1.14 --- php3/functions/dba.c:1.13 Mon May 10 07:15:02 1999 +++ php3/functions/dba.c Mon May 10 07:52:05 1999 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP HTML Embedded Scripting Language Version 3.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | + | Copyright (c) 1999 PHP Development Team (See Credits file) | +----------------------------------------------------------------------+ | This program is free software; you can redistribute it and/or modify | | it under the terms of one of the following licenses: | @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba.c,v 1.13 1999/05/10 11:15:02 sas Exp $ */ +/* $Id: dba.c,v 1.14 1999/05/10 11:52:05 sas Exp $ */ #include "php.h" @@ -110,7 +110,7 @@ #define DBA_ID_GET \ convert_to_long(id); \ DBA_IF_NOT_CORRECT_TYPE(id->value.lval) { \ - php3_error(E_WARNING, "Unable to find dba identifier %d", id->value.lval); \ + php3_error(E_WARNING, "Unable to find DBA identifier %d", id->value.lval); \ RETURN_FALSE; \ } @@ -190,7 +190,7 @@ { dba_handler *hptr; - PUTS("V1 ($Id: dba.c,v 1.13 1999/05/10 11:15:02 sas Exp $)"); + PUTS("V1 ($Id: dba.c,v 1.14 1999/05/10 11:52:05 sas Exp $)"); for(hptr = handler; hptr->name; hptr++) { PUTS(" "); PUTS(hptr->name); @@ -217,9 +217,11 @@ /* }}} */ /* {{{ _php3_dba_open */ +#define FREENOW if(args) efree(args); if(key) efree(key) + static void _php3_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) { - pval **args; + pval **args = (pval **) NULL; int ac = ARG_COUNT(ht); dba_mode_t modenr; dba_info *info; @@ -236,7 +238,7 @@ /* we pass additional args to the respective handler */ args = emalloc(ac * sizeof(pval *)); if(getParametersArray(ht, ac, args) != SUCCESS) { - efree(args); + FREENOW; WRONG_PARAM_COUNT; } @@ -257,8 +259,7 @@ } if(_php3_hash_find(&ht_keys, key, keylen, (void **) &info) == SUCCESS) { - efree(args); - efree(key); + FREENOW; RETURN_LONG(php3_list_insert(info, GLOBAL(le_pdb))); } } @@ -268,8 +269,7 @@ strcasecmp(hptr->name, args[2]->value.str.val); hptr++); if(!hptr->name) { - efree(args); - if(key) efree(key); + FREENOW; php3_error(E_WARNING, "no such handler: %s", args[2]->value.str.val); RETURN_FALSE; } @@ -286,8 +286,7 @@ break; default: php3_error(E_WARNING,"illegal DBA mode: %s",args[1]->value.str.val); - efree(args); - if(key) efree(key); + FREENOW; RETURN_FALSE; } @@ -301,8 +300,7 @@ if(hptr->open(info) != SUCCESS) { dba_close(info); php3_error(E_WARNING, "driver initialization failed"); - if(key) efree(key); - efree(args); + FREENOW; RETURN_FALSE; } info->hnd = hptr; @@ -314,10 +312,10 @@ _php3_hash_update(&ht_keys, key, keylen, info, sizeof(*info), NULL); } - efree(args); - if(key) efree(key); + FREENOW; RETURN_LONG(listid); } +#undef FREENOW /* }}} */ /* }}} */ @@ -370,7 +368,6 @@ if((val = info->hnd->fetch(info, VALLEN(key), &len)) != NULL) { RETVAL_STRINGL(val, len, 0); - return; } RETURN_FALSE; } Index: php3/functions/dba_cdb.c diff -u php3/functions/dba_cdb.c:1.9 php3/functions/dba_cdb.c:1.10 --- php3/functions/dba_cdb.c:1.9 Mon May 10 07:15:02 1999 +++ php3/functions/dba_cdb.c Mon May 10 07:52:05 1999 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP HTML Embedded Scripting Language Version 3.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | + | Copyright (c) 1999 PHP Development Team (See Credits file) | +----------------------------------------------------------------------+ | This program is free software; you can redistribute it and/or modify | | it under the terms of one of the following licenses: | @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba_cdb.c,v 1.9 1999/05/10 11:15:02 sas Exp $ */ +/* $Id: dba_cdb.c,v 1.10 1999/05/10 11:52:05 sas Exp $ */ #include "php.h" Index: php3/functions/dba_db2.c diff -u php3/functions/dba_db2.c:1.5 php3/functions/dba_db2.c:1.6 --- php3/functions/dba_db2.c:1.5 Mon May 10 07:15:02 1999 +++ php3/functions/dba_db2.c Mon May 10 07:52:05 1999 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba_db2.c,v 1.5 1999/05/10 11:15:02 sas Exp $ */ +/* $Id: dba_db2.c,v 1.6 1999/05/10 11:52:05 sas Exp $ */ #include "php.h" @@ -35,7 +35,7 @@ #include "php3_db2.h" #include <sys/stat.h> -#include <stdlib.h> +#include <string.h> #if DB2_DB2_DB_H #include <db2/db.h> #elif DB2_DB_DB2_H @@ -71,7 +71,8 @@ gmode = info->mode == DBA_READER ? DB_RDONLY : info->mode == DBA_WRITER ? DB_CREATE : - info->mode == DBA_TRUNC ? DB_TRUNCATE : -1; + info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1; + if(gmode == -1) return FAILURE; @@ -139,7 +140,7 @@ memset(&gval, 0, sizeof(gval)); if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) { - free(gval.data); + if(gval.data) free(gval.data); return SUCCESS; } return FAILURE; Index: php3/functions/dba_dbm.c diff -u php3/functions/dba_dbm.c:1.10 php3/functions/dba_dbm.c:1.11 --- php3/functions/dba_dbm.c:1.10 Mon May 10 07:15:02 1999 +++ php3/functions/dba_dbm.c Mon May 10 07:52:05 1999 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP HTML Embedded Scripting Language Version 3.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | + | Copyright (c) 1999 PHP Development Team (See Credits file) | +----------------------------------------------------------------------+ | This program is free software; you can redistribute it and/or modify | | it under the terms of one of the following licenses: | @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba_dbm.c,v 1.10 1999/05/10 11:15:02 sas Exp $ */ +/* $Id: dba_dbm.c,v 1.11 1999/05/10 11:52:05 sas Exp $ */ #include "php.h" Index: php3/functions/dba_gdbm.c diff -u php3/functions/dba_gdbm.c:1.9 php3/functions/dba_gdbm.c:1.10 --- php3/functions/dba_gdbm.c:1.9 Mon May 10 07:15:02 1999 +++ php3/functions/dba_gdbm.c Mon May 10 07:52:05 1999 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP HTML Embedded Scripting Language Version 3.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | + | Copyright (c) 1999 PHP Development Team (See Credits file) | +----------------------------------------------------------------------+ | This program is free software; you can redistribute it and/or modify | | it under the terms of one of the following licenses: | @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba_gdbm.c,v 1.9 1999/05/10 11:15:02 sas Exp $ */ +/* $Id: dba_gdbm.c,v 1.10 1999/05/10 11:52:05 sas Exp $ */ #include "php.h" Index: php3/functions/dba_ndbm.c diff -u php3/functions/dba_ndbm.c:1.8 php3/functions/dba_ndbm.c:1.9 --- php3/functions/dba_ndbm.c:1.8 Mon May 10 07:15:02 1999 +++ php3/functions/dba_ndbm.c Mon May 10 07:52:05 1999 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP HTML Embedded Scripting Language Version 3.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | + | Copyright (c) 1999 PHP Development Team (See Credits file) | +----------------------------------------------------------------------+ | This program is free software; you can redistribute it and/or modify | | it under the terms of one of the following licenses: | @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba_ndbm.c,v 1.8 1999/05/10 11:15:02 sas Exp $ */ +/* $Id: dba_ndbm.c,v 1.9 1999/05/10 11:52:05 sas Exp $ */ #include "php.h" -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5475) next »