Re: [PATCH 1/6] lib/cli: Make notmuch_database_open return a status code
authorAustin Clements <amdragon@MIT.EDU>
Mon, 30 Apr 2012 16:15:55 +0000 (12:15 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:50 +0000 (09:46 -0800)
e8/00f0a2642c70a90abd19d8e70288fa361bd002 [new file with mode: 0644]

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