about summary refs log tree commit diff
path: root/db2/hash
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-07 11:07:34 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-07 11:07:34 +0000
commit2c874db2dd8b34a36f00284c2c5d215a4c9506ac (patch)
tree679922799ac611eeff4513bfb7b0f880f1277b4f /db2/hash
parent88c9111883a14f2f3fd31471df6923f76b97e1a0 (diff)
downloadglibc-2c874db2dd8b34a36f00284c2c5d215a4c9506ac.tar.gz
glibc-2c874db2dd8b34a36f00284c2c5d215a4c9506ac.tar.xz
glibc-2c874db2dd8b34a36f00284c2c5d215a4c9506ac.zip
Update.
	* db2/btree/bt_cursor.c: Likewise.
	* db2/common/db_region.db_c: Likewise.
	* db2/common/db_salloc.db_c: Likewise.
	* db2/db/db.c: Likewise.
	* db2/db/db_rec.c: Likewise.
	* db2/hash/hash.c: Likewise.
	* db2/hash/hash_page.c: Likewise.
	* db2/hash/hash_rec.c: Likewise.
	* db2/log/log_findckp.c: Likewise.
	* db2/log/log_get.c: Likewise.
	* db2/log/log_put.c: Likewise.
	* db2/mp/mp_fget.c: Likewise.
	* db2/mp/mp_fput.c: Likewise.
	* db2/mp/mp_region.c: Likewise.
Diffstat (limited to 'db2/hash')
-rw-r--r--db2/hash/hash.c17
-rw-r--r--db2/hash/hash_page.c3
-rw-r--r--db2/hash/hash_rec.c31
3 files changed, 32 insertions, 19 deletions
diff --git a/db2/hash/hash.c b/db2/hash/hash.c
index 5e0660b727..0265f19659 100644
--- a/db2/hash/hash.c
+++ b/db2/hash/hash.c
@@ -359,11 +359,12 @@ __ham_get(dbp, txn, key, data, flags)
 
 	hashp->hash_accesses++;
 	hcp = (HASH_CURSOR *)TAILQ_FIRST(&ldbp->curs_queue)->internal;
-	if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_READ)) == 0)
+	if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_READ)) == 0) {
 		if (F_ISSET(hcp, H_OK))
 			ret = __ham_dup_return(hashp, hcp, data, DB_FIRST);
 		else /* Key was not found */
 			ret = DB_NOTFOUND;
+	}
 
 	if ((t_ret = __ham_item_done(hashp, hcp, 0)) != 0 && ret == 0)
 		ret = t_ret;
@@ -546,11 +547,12 @@ __ham_delete(dbp, txn, key, flags)
 	hcp = TAILQ_FIRST(&ldbp->curs_queue)->internal;
 
 	hashp->hash_accesses++;
-	if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_WRITE)) == 0)
+	if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_WRITE)) == 0) {
 		if (F_ISSET(hcp, H_OK))
 			ret = __ham_del_pair(hashp, hcp, 1);
 		else
 			ret = DB_NOTFOUND;
+	}
 
 	if ((t_ret = __ham_item_done(hashp, hcp, ret == 0)) != 0 && ret == 0)
 		ret = t_ret;
@@ -1109,7 +1111,7 @@ __ham_dup_return(hashp, hcp, val, flags)
 	 * duplicate.  In this case, we do initialization and then
 	 * let the normal duplicate code handle it.
 	 */
-	if (!F_ISSET(hcp, H_ISDUP))
+	if (!F_ISSET(hcp, H_ISDUP)) {
 		if (type == H_DUPLICATE) {
 			F_SET(hcp, H_ISDUP);
 			hcp->dup_tlen = LEN_HDATA(hcp->pagep,
@@ -1148,13 +1150,13 @@ __ham_dup_return(hashp, hcp, val, flags)
 			    hcp, pgno, 0, H_ISDUP)) != 0)
 				return (ret);
 		}
-
+	}
 
 	/*
 	 * Now, everything is initialized, grab a duplicate if
 	 * necessary.
 	 */
-	if (F_ISSET(hcp, H_ISDUP))
+	if (F_ISSET(hcp, H_ISDUP)) {
 		if (hcp->dpgno != PGNO_INVALID) {
 			pp = hcp->dpagep;
 			ndx = hcp->dndx;
@@ -1170,7 +1172,7 @@ __ham_dup_return(hashp, hcp, val, flags)
 			tmp_val.doff = hcp->dup_off + sizeof(db_indx_t);
 			myval = &tmp_val;
 		}
-
+	}
 
 	/*
 	 * Finally, if we had a duplicate, pp, ndx, and myval should be
@@ -1425,7 +1427,7 @@ __ham_c_update(hcp, chg_pgno, len, add, is_dup)
 				F_SET(lcp, H_DELETED);
 
 			/* Now adjust on-page information. */
-			if (lcp->dpgno == PGNO_INVALID)
+			if (lcp->dpgno == PGNO_INVALID) {
 				if (add) {
 					lcp->dup_tlen += len;
 					if (lcp->dndx > hcp->dndx)
@@ -1435,6 +1437,7 @@ __ham_c_update(hcp, chg_pgno, len, add, is_dup)
 					if (lcp->dndx > hcp->dndx)
 						lcp->dup_off -= len;
 				}
+			}
 		}
 	}
 	DB_THREAD_UNLOCK(hp->dbp);
diff --git a/db2/hash/hash_page.c b/db2/hash/hash_page.c
index ce692f2e41..5b3463947b 100644
--- a/db2/hash/hash_page.c
+++ b/db2/hash/hash_page.c
@@ -317,7 +317,7 @@ __ham_item_prev(hashp, cursorp, mode)
 	if (F_ISSET(cursorp, H_ISDUP)) {
 		if (cursorp->dpgno == PGNO_INVALID) {
 			/* Duplicates are on-page. */
-			if (cursorp->dup_off != 0)
+			if (cursorp->dup_off != 0) {
 				if ((ret = __ham_get_cpage(hashp,
 				    cursorp, mode)) != 0)
 					return (ret);
@@ -334,6 +334,7 @@ __ham_item_prev(hashp, cursorp, mode)
 					return (__ham_item(hashp,
 					    cursorp, mode));
 				}
+			}
 		} else if (cursorp->dndx > 0) {	/* Duplicates are off-page. */
 			cursorp->dndx--;
 			return (__ham_item(hashp, cursorp, mode));
diff --git a/db2/hash/hash_rec.c b/db2/hash/hash_rec.c
index efaf61c638..727f615828 100644
--- a/db2/hash/hash_rec.c
+++ b/db2/hash/hash_rec.c
@@ -93,7 +93,7 @@ __ham_insdel_recover(logp, dbtp, lsnp, redo, info)
 	REC_INTRO(__ham_insdel_read);
 
 	ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
-	if (ret != 0)
+	if (ret != 0) {
 		if (!redo) {
 			/*
 			 * We are undoing and the page doesn't exist.  That
@@ -107,7 +107,7 @@ __ham_insdel_recover(logp, dbtp, lsnp, redo, info)
 		} else if ((ret = memp_fget(mpf, &argp->pgno,
 		    DB_MPOOL_CREATE, &pagep)) != 0)
 			goto out;
-
+	}
 
 	hashp = (HTAB *)file_dbp->internal;
 	GET_META(file_dbp, hashp);
@@ -199,7 +199,7 @@ __ham_newpage_recover(logp, dbtp, lsnp, redo, info)
 	REC_INTRO(__ham_newpage_read);
 
 	ret = memp_fget(mpf, &argp->new_pgno, 0, &pagep);
-	if (ret != 0)
+	if (ret != 0) {
 		if (!redo) {
 			/*
 			 * We are undoing and the page doesn't exist.  That
@@ -212,6 +212,7 @@ __ham_newpage_recover(logp, dbtp, lsnp, redo, info)
 		} else if ((ret = memp_fget(mpf, &argp->new_pgno,
 		    DB_MPOOL_CREATE, &pagep)) != 0)
 			goto out;
+	}
 
 	hashp = (HTAB *)file_dbp->internal;
 	GET_META(file_dbp, hashp);
@@ -255,7 +256,7 @@ __ham_newpage_recover(logp, dbtp, lsnp, redo, info)
 ppage:	if (argp->prev_pgno != PGNO_INVALID) {
 		ret = memp_fget(mpf, &argp->prev_pgno, 0, &pagep);
 
-		if (ret != 0)
+		if (ret != 0) {
 			if (!redo) {
 				/*
 				 * We are undoing and the page doesn't exist.
@@ -269,6 +270,7 @@ ppage:	if (argp->prev_pgno != PGNO_INVALID) {
 			    memp_fget(mpf, &argp->prev_pgno,
 			    DB_MPOOL_CREATE, &pagep)) != 0)
 				goto out;
+		}
 
 		cmp_n = log_compare(lsnp, &LSN(pagep));
 		cmp_p = log_compare(&LSN(pagep), &argp->prevlsn);
@@ -300,7 +302,7 @@ ppage:	if (argp->prev_pgno != PGNO_INVALID) {
 npage:	if (argp->next_pgno != PGNO_INVALID) {
 		ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep);
 
-		if (ret != 0)
+		if (ret != 0) {
 			if (!redo) {
 				/*
 				 * We are undoing and the page doesn't exist.
@@ -315,6 +317,7 @@ npage:	if (argp->next_pgno != PGNO_INVALID) {
 			    memp_fget(mpf, &argp->next_pgno,
 			    DB_MPOOL_CREATE, &pagep)) != 0)
 				goto out;
+		}
 
 		cmp_n = log_compare(lsnp, &LSN(pagep));
 		cmp_p = log_compare(&LSN(pagep), &argp->nextlsn);
@@ -384,7 +387,7 @@ __ham_replace_recover(logp, dbtp, lsnp, redo, info)
 	REC_INTRO(__ham_replace_read);
 
 	ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
-	if (ret != 0)
+	if (ret != 0) {
 		if (!redo) {
 			/*
 			 * We are undoing and the page doesn't exist.  That
@@ -398,6 +401,7 @@ __ham_replace_recover(logp, dbtp, lsnp, redo, info)
 		} else if ((ret = memp_fget(mpf, &argp->pgno,
 		    DB_MPOOL_CREATE, &pagep)) != 0)
 			goto out;
+	}
 
 	hashp = (HTAB *)file_dbp->internal;
 	GET_META(file_dbp, hashp);
@@ -518,7 +522,7 @@ __ham_newpgno_recover(logp, dbtp, lsnp, redo, info)
 	/* Now check the newly allocated/freed page. */
 	ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
 
-	if (ret != 0)
+	if (ret != 0) {
 		if (!redo) {
 			/*
 			 * We are undoing and the page doesn't exist.  That
@@ -532,6 +536,7 @@ __ham_newpgno_recover(logp, dbtp, lsnp, redo, info)
 		} else if ((ret = memp_fget(mpf, &argp->pgno,
 		    DB_MPOOL_CREATE, &pagep)) != 0)
 			goto out;
+	}
 
 	cmp_n = log_compare(lsnp, &LSN(pagep));
 	cmp_p = log_compare(&LSN(pagep), &argp->pagelsn);
@@ -672,7 +677,7 @@ __ham_splitdata_recover(logp, dbtp, lsnp, redo, info)
 	REC_INTRO(__ham_splitdata_read);
 
 	ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
-	if (ret != 0)
+	if (ret != 0) {
 		if (!redo) {
 			/*
 			 * We are undoing and the page doesn't exist.  That
@@ -686,6 +691,7 @@ __ham_splitdata_recover(logp, dbtp, lsnp, redo, info)
 		} else if ((ret = memp_fget(mpf, &argp->pgno,
 		    DB_MPOOL_CREATE, &pagep)) != 0)
 			goto out;
+	}
 
 	hashp = (HTAB *)file_dbp->internal;
 	GET_META(file_dbp, hashp);
@@ -850,7 +856,7 @@ __ham_copypage_recover(logp, dbtp, lsnp, redo, info)
 
 	/* This is the bucket page. */
 	ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
-	if (ret != 0)
+	if (ret != 0) {
 		if (!redo) {
 			/*
 			 * We are undoing and the page doesn't exist.  That
@@ -863,6 +869,7 @@ __ham_copypage_recover(logp, dbtp, lsnp, redo, info)
 		} else if ((ret = memp_fget(mpf, &argp->pgno,
 		    DB_MPOOL_CREATE, &pagep)) != 0)
 			goto out;
+	}
 
 	cmp_n = log_compare(lsnp, &LSN(pagep));
 	cmp_p = log_compare(&LSN(pagep), &argp->pagelsn);
@@ -884,7 +891,7 @@ __ham_copypage_recover(logp, dbtp, lsnp, redo, info)
 
 	/* Now fix up the "next" page. */
 donext:	ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep);
-	if (ret != 0)
+	if (ret != 0) {
 		if (!redo) {
 			/*
 			 * We are undoing and the page doesn't exist.  That
@@ -897,6 +904,7 @@ donext:	ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep);
 		} else if ((ret = memp_fget(mpf, &argp->next_pgno,
 		    DB_MPOOL_CREATE, &pagep)) != 0)
 			goto out;
+	}
 
 	/* There is nothing to do in the REDO case; only UNDO. */
 
@@ -916,7 +924,7 @@ do_nn:	if (argp->nnext_pgno == PGNO_INVALID) {
 	}
 
 	ret = memp_fget(mpf, &argp->nnext_pgno, 0, &pagep);
-	if (ret != 0)
+	if (ret != 0) {
 		if (!redo) {
 			/*
 			 * We are undoing and the page doesn't exist.  That
@@ -930,6 +938,7 @@ do_nn:	if (argp->nnext_pgno == PGNO_INVALID) {
 		} else if ((ret = memp_fget(mpf, &argp->nnext_pgno,
 		    DB_MPOOL_CREATE, &pagep)) != 0)
 			goto out;
+	}
 
 	cmp_n = log_compare(lsnp, &LSN(pagep));
 	cmp_p = log_compare(&LSN(pagep), &argp->nnextlsn);