cvs: php4 /ext/dba dba_db2.c
| From: | Sascha Schumann | Date: | Wed, 10 Apr 2002 12:22:36 +0000 |
| Subject: | cvs: php4 /ext/dba dba_db2.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11004@lists.php.net to get a copy of this message | ||
sas Wed Apr 10 08:22:36 2002 EDT
Modified files:
/php4/ext/dba dba_db2.c
Log:
ws changes
Index: php4/ext/dba/dba_db2.c
diff -u php4/ext/dba/dba_db2.c:1.24 php4/ext/dba/dba_db2.c:1.25
--- php4/ext/dba/dba_db2.c:1.24 Wed Apr 10 08:16:31 2002
+++ php4/ext/dba/dba_db2.c Wed Apr 10 08:22:36 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_db2.c,v 1.24 2002/04/10 12:16:31 sas Exp $ */
+/* $Id: dba_db2.c,v 1.25 2002/04/10 12:22:36 sas Exp $ */
#include "php.h"
@@ -32,7 +32,8 @@
#define DB2_DATA dba_db2_data *dba = info->dbf
#define DB2_GKEY \
DBT gkey = {0}; \
- gkey.data = (char *) key; gkey.size = keylen
+ gkey.data = (char *) key; \
+ gkey.size = keylen
typedef struct {
DB *dbp;
@@ -48,7 +49,7 @@
struct stat check_stat;
int s = VCWD_STAT(info->path, &check_stat);
- type = info->mode == DBA_READER ? DB_UNKNOWN :
+ type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
s ? DB_BTREE : DB_UNKNOWN;
@@ -58,15 +59,15 @@
info->mode == DBA_WRITER ? 0 :
info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
- if(gmode == -1)
+ if (gmode == -1)
return FAILURE;
- if(info->argc > 0) {
+ if (info->argc > 0) {
convert_to_long_ex(info->argv[0]);
filemode = Z_LVAL_PP(info->argv[0]);
}
- if(db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) {
+ if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) {
return FAILURE;
}
@@ -79,7 +80,8 @@
{
DB2_DATA;
- if(dba->cursor) dba->cursor->c_close(dba->cursor);
+ if (dba->cursor)
+ dba->cursor->c_close(dba->cursor);
dba->dbp->close(dba->dbp, 0);
free(dba);
}
@@ -90,11 +92,11 @@
DB2_DATA;
DB2_GKEY;
- if(dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
+ if (dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
return NULL;
}
- if(newlen) *newlen = gval.size;
+ if (newlen) *newlen = gval.size;
return estrndup(gval.data, gval.size);
}
@@ -107,7 +109,7 @@
gval.data = (char *) val;
gval.size = vallen;
- if(dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
+ if (dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
mode == 1 ? DB_NOOVERWRITE : 0)) {
return FAILURE;
}
@@ -120,7 +122,7 @@
DB2_DATA;
DB2_GKEY;
- if(dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
+ if (dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
return FAILURE;
}
return SUCCESS;
@@ -138,15 +140,15 @@
{
DB2_DATA;
- if(dba->cursor) {
+ if (dba->cursor) {
dba->cursor->c_close(dba->cursor);
dba->cursor = NULL;
}
#if (DB_VERSION_MAJOR > 2) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR > 6) ||
(DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 6 && DB_VERSION_PATCH >= 4)
- if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0)) {
+ if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0)) {
#else
- if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor)) {
+ if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor)) {
#endif
return NULL;
}
@@ -160,11 +162,11 @@
DB2_DATA;
DBT gkey = {0}, gval = {0};
- if(dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT)
+ if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT)
|| !gkey.data)
return NULL;
- if(newlen) *newlen = gkey.size;
+ if (newlen) *newlen = gkey.size;
return estrndup(gkey.data, gkey.size);
}