Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/db/btree - use sizeof(var) instead of sizeof(type)



details:   https://anonhg.NetBSD.org/src/rev/30f96d909c3c
branches:  trunk
changeset: 766544:30f96d909c3c
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jun 26 22:20:31 2011 +0000

description:
- use sizeof(var) instead of sizeof(type)
- remove useless cast

diffstat:

 lib/libc/db/btree/bt_overflow.c |  10 +++++-----
 lib/libc/db/btree/bt_put.c      |   8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diffs (81 lines):

diff -r 70648f2fb985 -r 30f96d909c3c lib/libc/db/btree/bt_overflow.c
--- a/lib/libc/db/btree/bt_overflow.c   Sun Jun 26 22:18:16 2011 +0000
+++ b/lib/libc/db/btree/bt_overflow.c   Sun Jun 26 22:20:31 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bt_overflow.c,v 1.16 2008/09/11 12:58:00 joerg Exp $   */
+/*     $NetBSD: bt_overflow.c,v 1.17 2011/06/26 22:20:31 christos Exp $        */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_overflow.c,v 1.16 2008/09/11 12:58:00 joerg Exp $");
+__RCSID("$NetBSD: bt_overflow.c,v 1.17 2011/06/26 22:20:31 christos Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -87,7 +87,7 @@
        uint32_t sz, nb, plen;
        size_t temp;
 
-       memmove(&pg, p, sizeof(pgno_t));
+       memmove(&pg, p, sizeof(pg));
        memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(uint32_t));
        *ssz = sz;
 
@@ -97,7 +97,7 @@
 #endif
        /* Make the buffer bigger as necessary. */
        if (*bufsz < sz) {
-               *buf = (char *)(*buf == NULL ? malloc(sz) : realloc(*buf, sz));
+               *buf = (*buf == NULL ? malloc(sz) : realloc(*buf, sz));
                if (*buf == NULL)
                        return (RET_ERROR);
                *bufsz = sz;
@@ -200,7 +200,7 @@
        uint32_t sz, plen;
        size_t temp;
 
-       (void)memmove(&pg, p, sizeof(pgno_t));
+       (void)memmove(&pg, p, sizeof(pg));
        (void)memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(uint32_t));
 
 #ifdef DEBUG
diff -r 70648f2fb985 -r 30f96d909c3c lib/libc/db/btree/bt_put.c
--- a/lib/libc/db/btree/bt_put.c        Sun Jun 26 22:18:16 2011 +0000
+++ b/lib/libc/db/btree/bt_put.c        Sun Jun 26 22:20:31 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bt_put.c,v 1.19 2009/02/12 06:40:14 lukem Exp $        */
+/*     $NetBSD: bt_put.c,v 1.20 2011/06/26 22:20:31 christos Exp $     */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_put.c,v 1.19 2009/02/12 06:40:14 lukem Exp $");
+__RCSID("$NetBSD: bt_put.c,v 1.20 2011/06/26 22:20:31 christos Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -127,7 +127,7 @@
                                return (RET_ERROR);
                        tkey.data = kb;
                        tkey.size = NOVFLSIZE;
-                       memmove(kb, &pg, sizeof(pgno_t));
+                       memmove(kb, &pg, sizeof(pg));
                        memmove(kb + sizeof(pgno_t),
                            &key->size, sizeof(uint32_t));
                        dflags |= P_BIGKEY;
@@ -138,7 +138,7 @@
                                return (RET_ERROR);
                        tdata.data = db;
                        tdata.size = NOVFLSIZE;
-                       memmove(db, &pg, sizeof(pgno_t));
+                       memmove(db, &pg, sizeof(pg));
                        _DBFIT(data->size, uint32_t);
                        temp = (uint32_t)data->size;
                        (void)memmove(db + sizeof(pgno_t),



Home | Main Index | Thread Index | Old Index