Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 78F9D431FAF for ; Mon, 30 Apr 2012 09:15:59 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RDtS0EQ3-y4s for ; Mon, 30 Apr 2012 09:15:59 -0700 (PDT) Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU [18.7.68.37]) by olra.theworths.org (Postfix) with ESMTP id EE3F2431FAE for ; Mon, 30 Apr 2012 09:15:58 -0700 (PDT) X-AuditID: 12074425-b7f4a6d0000008e0-f0-4f9ebabdedec Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP id 24.E4.02272.DBABE9F4; Mon, 30 Apr 2012 12:15:57 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q3UGFuU3028222; Mon, 30 Apr 2012 12:15:57 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q3UGFtpH002164 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 30 Apr 2012 12:15:56 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1SOtGV-000718-Ag; Mon, 30 Apr 2012 12:15:55 -0400 Date: Mon, 30 Apr 2012 12:15:55 -0400 From: Austin Clements To: David Bremner Subject: Re: [PATCH 1/6] lib/cli: Make notmuch_database_open return a status code Message-ID: <20120430161555.GP2704@mit.edu> References: <1335651473-19652-1-git-send-email-amdragon@mit.edu> <1335651473-19652-2-git-send-email-amdragon@mit.edu> <87pqapphxn.fsf@zancas.localnet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87pqapphxn.fsf@zancas.localnet> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IR4hTV1t27a56/wYqTxhY3WrsZLa7fnMns wOTxbNUtZo8th94zBzBFcdmkpOZklqUW6dslcGXsvHiBveAjW8Wx7WvZGxgXsXYxcnJICJhI 7H7wnQnCFpO4cG89WxcjF4eQwD5Gib3bjkM5GxglFj/tZ4FwTjJJHL+6gwnCWcIocePQAxaQ fhYBVYmXPZ3sIDabgIbEtv3LGUFsEaD41W2T2UBsZgFpiW+/m8H2CQsES0xYMxfM5hXQlti0 7inU0FlAu6+cYYRICEqcnPmEBaJZS+LGv5dARRxgg5b/4wAJcwroSrRcfc4MYosKqEhMObmN bQKj0Cwk3bOQdM9C6F7AyLyKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI10IvN7NELzWldBMjKLTZ XVR3ME44pHSIUYCDUYmHd9L8ef5CrIllxZW5hxglOZiURHlNdwCF+JLyUyozEosz4otKc1KL DzFKcDArifCWTgTK8aYkVlalFuXDpKQ5WJTEeTW13vkJCaQnlqRmp6YWpBbBZGU4OJQkeB/u BGoULEpNT61Iy8wpQUgzcXCCDOcBGv4cpIa3uCAxtzgzHSJ/ilFRSpz3IEhCACSRUZoH1wtL Pa8YxYFeEebdDVLFA0xbcN2vgAYzAQ3ONwcbXJKIkJJqYDwVXZFv/7VW0+l9KO+duJIvWte2 O36vn/mTt0qnb9LB22aXn8Q+Nze6dOHs/+eB8lmPhS9or37upLUpiM+CIzLp7Dcdc8PII7Ms A9w53u8I5O8xkgrx/32qdsKHtI70M31bYi8mtfElPl7pKbFN+mKLTk2T93z9lBm6ebnh03qf s/B7TsrpVWIpzkg01GIuKk4EAF5h5uQYAwAA Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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, 30 Apr 2012 16:15:59 -0000 Quoth David Bremner on Apr 30 at 8:39 am: > > I have two questions, both of which might have been settled previously. > > > > > - return notmuch; > > + *database = notmuch; > > + return status; > > } > > Should we check database is non-NULL here? Sure, why not. Since one could now imagine using these functions to create a database without using it or test if a database exists, I made them handle a NULL pointer gracefully. > > diff --git a/notmuch-count.c b/notmuch-count.c > > index 9c2ad7b..2f98128 100644 > > --- a/notmuch-count.c > > +++ b/notmuch-count.c > > > + if (notmuch_database_open (notmuch_config_get_database_path (config), > > + NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) > > Is it OK to rely on NOTMUCH_STATUS_SUCCESS==0 ? I decree it so. Plus, we already do this sort of thing all over the place.