Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/db/hash Make the packing more dense in a couple of ...



details:   https://anonhg.NetBSD.org/src/rev/4625a87c548b
branches:  trunk
changeset: 474990:4625a87c548b
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Wed Jul 28 19:41:36 1999 +0000

description:
Make the packing more dense in a couple of cases.

diffstat:

 lib/libc/db/hash/hash_bigkey.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 3889adc07fd9 -r 4625a87c548b lib/libc/db/hash/hash_bigkey.c
--- a/lib/libc/db/hash/hash_bigkey.c    Wed Jul 28 19:33:03 1999 +0000
+++ b/lib/libc/db/hash/hash_bigkey.c    Wed Jul 28 19:41:36 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hash_bigkey.c,v 1.11 1999/07/28 19:33:03 mycroft Exp $ */
+/*     $NetBSD: hash_bigkey.c,v 1.12 1999/07/28 19:41:36 mycroft Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)hash_bigkey.c      8.3 (Berkeley) 5/31/94";
 #else
-__RCSID("$NetBSD: hash_bigkey.c,v 1.11 1999/07/28 19:33:03 mycroft Exp $");
+__RCSID("$NetBSD: hash_bigkey.c,v 1.12 1999/07/28 19:41:36 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -129,13 +129,14 @@
                        return (-1);
                n = p[0];
                if (!key_size) {
-                       if (FREESPACE(p)) {
-                               move_bytes = MIN(FREESPACE(p), val_size);
+                       space = FREESPACE(p);
+                       if (space) {
+                               move_bytes = MIN(space, val_size);
                                /*
                                 * Here's the hack to make sure that if the data ends on the
                                 * same page as the key ends, FREESPACE is at least one.
                                 */
-                               if (move_bytes == val_size && val_size == val->size)
+                               if (space == val_size && val_size == val->size)
                                        move_bytes--;
                                off = OFFSET(p) - move_bytes;
                                memmove(cp + off, val_data, (size_t)move_bytes);
@@ -161,7 +162,7 @@
                 * Here's the hack to make sure that if the data ends on the
                 * same page as the key ends, FREESPACE is at least one.
                 */
-               if (move_bytes == val_size && val_size == val->size)
+               if (space == val_size && val_size == val->size)
                        move_bytes--;
                off = OFFSET(p) - move_bytes;
                memmove(cp + off, val_data, (size_t)move_bytes);



Home | Main Index | Thread Index | Old Index