From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 3A7AA6DE2E94 for ; Mon, 26 Jun 2017 06:04:37 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aQuome3eHnOs for ; Mon, 26 Jun 2017 06:04:32 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 9A6B56DE2E52 for ; Mon, 26 Jun 2017 06:04:32 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1dPTdl-000249-Pw; Mon, 26 Jun 2017 09:01:17 -0400 Received: (nullmailer pid 5986 invoked by uid 1000); Mon, 26 Jun 2017 13:04:25 -0000 From: David Bremner To: Piotr Trojanek , Daniel Kahn Gillmor Cc: notmuch@notmuchmail.org Subject: Re: [PATCH 4/5] fix wrong printf formatting of signed/unsigned integers In-Reply-To: References: <20170616225026.8098-1-piotr.trojanek@gmail.com> <20170616225026.8098-4-piotr.trojanek@gmail.com> <87fuetiamo.fsf@fifthhorseman.net> Date: Mon, 26 Jun 2017 10:04:25 -0300 Message-ID: <874lv2vr1i.fsf@tesseract.cs.unb.ca> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jun 2017 13:04:37 -0000 Piotr Trojanek writes: > For the second FIXME, I don't quite see why not just use the bsearch > function. It could be called either with strcmp (if exact is true) or > with a simple wrapper around strncmp (if exact is false). This wrapper > could replace the string_cmp routine, so together with bsearch this > could even make the code smaller. AFAIK, bsearch does not guarantee to return the first string matching the key, which is what we need here. > > Also, I don't really understand the intention behind declaring > string_cmp as returning notmuch_bool_t and then, in bsearch_first, > casting its result to int. yes, that looks odd to me also, especially since it really just wraps strcmp / strncmp, which are signed. Probably just an error on my part. d