CVS update: php3/functions

From: Date: Wed, 21 Apr 1999 15:57:09 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5177@lists.php.net to get a copy of this message
Date: Wednesday April 21, 1999 @ 11:57 Author: sas Update of /repository/php3/functions In directory php:/tmp/cvs-serv11650/functions Modified Files: dba.c dba_gdbm.c Log Message: cleanup Index: php3/functions/dba.c diff -c php3/functions/dba.c:1.6 php3/functions/dba.c:1.7 *** php3/functions/dba.c:1.6 Wed Apr 21 05:50:13 1999 --- php3/functions/dba.c Wed Apr 21 11:57:09 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: dba.c,v 1.6 1999/04/21 09:50:13 sas Exp $ */ #include "php.h" --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dba.c,v 1.7 1999/04/21 15:57:09 sas Exp $ */ #include "php.h" *************** *** 156,163 **** static void dba_close(dba_info *info) { if(info->hnd) info->hnd->close(info); ! if(info->path) efree(info->path); ! efree(info); } /* }}} */ /* {{{ php3_minit_dba */ --- 156,163 ---- static void dba_close(dba_info *info) { if(info->hnd) info->hnd->close(info); ! if(info->path) free(info->path); ! free(info); } /* }}} */ /* {{{ php3_minit_dba */ *************** *** 184,190 **** { dba_handler *hptr; ! PUTS("V1 ($Id: dba.c,v 1.6 1999/04/21 09:50:13 sas Exp $)"); for(hptr = handler; hptr->name; hptr++) { PUTS(" "); PUTS(hptr->name); --- 184,190 ---- { dba_handler *hptr; ! PUTS("V1 ($Id: dba.c,v 1.7 1999/04/21 15:57:09 sas Exp $)"); for(hptr = handler; hptr->name; hptr++) { PUTS(" "); PUTS(hptr->name); *************** *** 282,290 **** RETURN_FALSE; } ! info = emalloc(sizeof(*info)); memset(info, 0, sizeof(info)); ! info->path = estrndup(args[0]->value.str.val, args[0]->value.str.len); info->mode = modenr; info->argc = ac - 3; info->argv = args + 3; --- 282,290 ---- RETURN_FALSE; } ! info = malloc(sizeof(*info)); memset(info, 0, sizeof(info)); ! info->path = strdup(args[0]->value.str.val); info->mode = modenr; info->argc = ac - 3; info->argv = args + 3; Index: php3/functions/dba_gdbm.c diff -c php3/functions/dba_gdbm.c:1.4 php3/functions/dba_gdbm.c:1.5 *** php3/functions/dba_gdbm.c:1.4 Wed Apr 21 05:50:13 1999 --- php3/functions/dba_gdbm.c Wed Apr 21 11:57:09 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: dba_gdbm.c,v 1.4 1999/04/21 09:50:13 sas Exp $ */ #include "php.h" --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dba_gdbm.c,v 1.5 1999/04/21 15:57:09 sas Exp $ */ #include "php.h" *************** *** 64,72 **** dbf = gdbm_open(info->path, 0, gmode, 0644, NULL); if(dbf) { ! info->dbf = emalloc(sizeof dba_gdbm_data); ! memset(info->dbf, 0, sizeof dba_gdbm_data); ! info->dbf->dbf = dbf; return SUCCESS; } return FAILURE; --- 64,72 ---- dbf = gdbm_open(info->path, 0, gmode, 0644, NULL); if(dbf) { ! info->dbf = emalloc(sizeof(dba_gdbm_data)); ! memset(info->dbf, 0, sizeof(dba_gdbm_data)); ! ((dba_gdbm_data *) info->dbf)->dbf = dbf; return SUCCESS; } return FAILURE; *************** *** 144,150 **** if(newlen) *newlen = gkey.dsize; dba->nextkey = gkey; } else { ! dba->nextkey = {0,0}; } return key; } --- 144,150 ---- if(newlen) *newlen = gkey.dsize; dba->nextkey = gkey; } else { ! dba->nextkey.dptr = NULL; } return key; } *************** *** 153,169 **** { GDBM_DATA; char *nkey = NULL; if(!dba->nextkey.dptr) return NULL; gkey = gdbm_nextkey(dba->dbf, dba->nextkey); ! free(dba->nextkey.gptr); if(gkey.dptr) { nkey = estrndup(gkey.dptr, gkey.dsize); if(newlen) *newlen = gkey.dsize; dba->nextkey = gkey; } else { ! dba->nextkey = {0,0}; } return nkey; } --- 153,170 ---- { GDBM_DATA; char *nkey = NULL; + datum gkey; if(!dba->nextkey.dptr) return NULL; gkey = gdbm_nextkey(dba->dbf, dba->nextkey); ! free(dba->nextkey.dptr); if(gkey.dptr) { nkey = estrndup(gkey.dptr, gkey.dsize); if(newlen) *newlen = gkey.dsize; dba->nextkey = gkey; } else { ! dba->nextkey.dptr = NULL; } return nkey; } -- 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 (#5177) next »