]> granicus.if.org Git - php/commitdiff
ws changes
authorSascha Schumann <sas@php.net>
Wed, 10 Apr 2002 12:22:36 +0000 (12:22 +0000)
committerSascha Schumann <sas@php.net>
Wed, 10 Apr 2002 12:22:36 +0000 (12:22 +0000)
ext/dba/dba_db2.c

index 49f53abcac758f2d773f2de70104ee068f00812a..08c9f4f2bd28b1c5bd94f19bb3885fb120b7b973 100644 (file)
@@ -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 @@ DBA_OPEN_FUNC(db2)
        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 @@ DBA_OPEN_FUNC(db2)
                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 @@ DBA_CLOSE_FUNC(db2)
 {
        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 @@ DBA_FETCH_FUNC(db2)
        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 @@ DBA_UPDATE_FUNC(db2)
        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 @@ DBA_EXISTS_FUNC(db2)
        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 @@ DBA_FIRSTKEY_FUNC(db2)
 {
        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 @@ DBA_NEXTKEY_FUNC(db2)
        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);
 }