From cf4e8ba25eaeb5586c1160ef9b6cf61a57871e02 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 29 Aug 2014 11:32:01 +0000 Subject: [PATCH] Pull up following revision(s) (requested by riastradh): common/lib/libc/gen/rb.c: revision 1.12 common/lib/libc/gen/rb.c: revision 1.13 Fix failure case in rb_tree_find_node_leq/geq. Return NULL, not `NULL - offset'. XXX pullup to netbsd-5, netbsd-6, netbsd-7 Remove enclosing parens on return. --- common/lib/libc/gen/rb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/lib/libc/gen/rb.c b/common/lib/libc/gen/rb.c index 098ab6cd1553..834ba0ca3a40 100644 --- a/common/lib/libc/gen/rb.c +++ b/common/lib/libc/gen/rb.c @@ -1,4 +1,4 @@ -/* $NetBSD: rb.c,v 1.11 2011/06/20 09:11:16 mrg Exp $ */ +/* $NetBSD: rb.c,v 1.11.22.1 2014/08/29 11:32:01 martin Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -39,10 +39,10 @@ #else #define KASSERT(s) do { } while (/*CONSTCOND*/ 0) #endif -__RCSID("$NetBSD: rb.c,v 1.11 2011/06/20 09:11:16 mrg Exp $"); +__RCSID("$NetBSD: rb.c,v 1.11.22.1 2014/08/29 11:32:01 martin Exp $"); #else #include -__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.11 2011/06/20 09:11:16 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.11.22.1 2014/08/29 11:32:01 martin Exp $"); #endif #ifdef _LIBC @@ -145,7 +145,7 @@ rb_tree_find_node_geq(struct rb_tree *rbt, const void *key) parent = parent->rb_nodes[diff < 0]; } - return RB_NODETOITEM(rbto, last); + return last == NULL ? NULL : RB_NODETOITEM(rbto, last); } void * @@ -166,7 +166,7 @@ rb_tree_find_node_leq(struct rb_tree *rbt, const void *key) parent = parent->rb_nodes[diff < 0]; } - return RB_NODETOITEM(rbto, last); + return last == NULL ? NULL : RB_NODETOITEM(rbto, last); } void *