Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753407AbZI0RFJ (ORCPT ); Sun, 27 Sep 2009 13:05:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753110AbZI0RFI (ORCPT ); Sun, 27 Sep 2009 13:05:08 -0400 Received: from BISCAYNE-ONE-STATION.MIT.EDU ([18.7.7.80]:43676 "EHLO biscayne-one-station.mit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752881AbZI0RFH (ORCPT ); Sun, 27 Sep 2009 13:05:07 -0400 Date: Sun, 27 Sep 2009 13:05:01 -0400 (EDT) From: Tim Abbott X-X-Sender: tabbott@dr-wily.mit.edu To: Rusty Russell cc: Alan Jenkins , Linux Kernel Mailing List , linux-kbuild@vger.kernel.org, linux-modules@vger.kernel.org Subject: Re: [PATCH 1/2] lib: Add generic binary search function to the kernel. In-Reply-To: <200909240941.41479.rusty@rustcorp.com.au> Message-ID: References: <1253626718-18887-5-git-send-email-alan-jenkins@tuffmail.co.uk> <1253726926-5504-2-git-send-email-tabbott@ksplice.com> <200909240941.41479.rusty@rustcorp.com.au> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Flag: NO X-Spam-Score: 0.00 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 689 Lines: 23 On Thu, 24 Sep 2009, Rusty Russell wrote: > On Thu, 24 Sep 2009 02:58:45 am Tim Abbott wrote: > > +void *bsearch(const void *key, const void *base, size_t num, size_t size, > > + int (*cmp)(const void *key, const void *elt)) > > +{ > > + int start = 0, end = num - 1, mid, result; > > + if (num == 0) > > + return NULL; > > + > > + while (start <= end) { > > The if (num == 0) line is superfluous. You are quite right. -Tim Abbott -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/