Module Name: src Committed By: matt Date: Fri Jul 13 01:15:27 UTC 2012
Modified Files: src/common/lib/libc/gen: ptree.c Log Message: Don't bother testing 0 length keys since they can only have one possible value. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/gen/ptree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/gen/ptree.c diff -u src/common/lib/libc/gen/ptree.c:1.6 src/common/lib/libc/gen/ptree.c:1.7 --- src/common/lib/libc/gen/ptree.c:1.6 Wed Jul 11 00:19:28 2012 +++ src/common/lib/libc/gen/ptree.c Fri Jul 13 01:15:27 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ptree.c,v 1.6 2012/07/11 00:19:28 rmind Exp $ */ +/* $NetBSD: ptree.c,v 1.7 2012/07/13 01:15:27 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include <sys/types.h> #include <sys/systm.h> #include <lib/libkern/libkern.h> -__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.6 2012/07/11 00:19:28 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.7 2012/07/13 01:15:27 matt Exp $"); #else #include <stddef.h> #include <stdint.h> @@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1. #else #define KASSERT(e) do { } while (/*CONSTCOND*/ 0) #endif -__RCSID("$NetBSD: ptree.c,v 1.6 2012/07/11 00:19:28 rmind Exp $"); +__RCSID("$NetBSD: ptree.c,v 1.7 2012/07/13 01:15:27 matt Exp $"); #endif /* _KERNEL || _STANDALONE */ #ifdef _LIBC @@ -134,7 +134,7 @@ ptree_testnode(const pt_tree_t *pt, cons { const pt_bitlen_t bitlen = PTN_BRANCH_BITLEN(ptn); if (bitlen == 0) - return PT_SLOT_ROOT; + return PT_SLOT_ROOT; /* mask or root, doesn't matter */ return (*pt->pt_ops->ptto_testnode)(NODETOKEY(pt, target), PTN_BRANCH_BITOFF(ptn), bitlen, pt->pt_context); } @@ -150,6 +150,9 @@ ptree_matchkey(const pt_tree_t *pt, cons static inline pt_slot_t ptree_testkey(const pt_tree_t *pt, const void *key, const pt_node_t *ptn) { + const pt_bitlen_t bitlen = PTN_BRANCH_BITLEN(ptn); + if (bitlen == 0) + return PT_SLOT_ROOT; /* mask or root, doesn't matter */ return (*pt->pt_ops->ptto_testkey)(key, PTN_BRANCH_BITOFF(ptn), PTN_BRANCH_BITLEN(ptn), pt->pt_context); }