1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 4A0B0431FD5
\r
6 for <notmuch@notmuchmail.org>; Thu, 23 Jan 2014 04:24:42 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id G0ZlZ1IQvD8y for <notmuch@notmuchmail.org>;
\r
16 Thu, 23 Jan 2014 04:24:36 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id C56FA431FB6
\r
21 for <notmuch@notmuchmail.org>; Thu, 23 Jan 2014 04:24:21 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tethera.net>)
\r
24 id 1W6JKX-0006X4-BR; Thu, 23 Jan 2014 08:24:21 -0400
\r
25 Received: (nullmailer pid 17153 invoked by uid 1000); Thu, 23 Jan 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH 2/3] lib: make notmuch_threads_valid return FALSE when passed
\r
31 Date: Thu, 23 Jan 2014 08:24:00 -0400
\r
32 Message-Id: <1390479841-17045-3-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 1.8.5.2
\r
34 In-Reply-To: <1390479841-17045-1-git-send-email-david@tethera.net>
\r
35 References: <m2r47zrkkc.fsf@guru.guru-group.fi>
\r
36 <1390479841-17045-1-git-send-email-david@tethera.net>
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Thu, 23 Jan 2014 12:24:42 -0000
\r
51 Without this patch, the example code in the header docs crashes for certain
\r
52 invalid queries (see id:871u00oimv.fsf@approx.mit.edu)
\r
54 lib/notmuch.h | 2 ++
\r
55 lib/query.cc | 3 +++
\r
56 2 files changed, 5 insertions(+)
\r
58 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
59 index 02604c5..68896ae 100644
\r
62 @@ -802,6 +802,8 @@ notmuch_query_destroy (notmuch_query_t *query);
\r
63 * valid object. Whereas when this function returns FALSE,
\r
64 * notmuch_threads_get will return NULL.
\r
66 + * If passed a NULL pointer, this function returns FALSE
\r
68 * See the documentation of notmuch_query_search_threads for example
\r
69 * code showing how to iterate over a notmuch_threads_t object.
\r
71 diff --git a/lib/query.cc b/lib/query.cc
\r
72 index ec60e2e..60ff8bd 100644
\r
75 @@ -462,6 +462,9 @@ notmuch_threads_valid (notmuch_threads_t *threads)
\r
77 unsigned int doc_id;
\r
82 while (threads->doc_id_pos < threads->doc_ids->len) {
\r
83 doc_id = g_array_index (threads->doc_ids, unsigned int,
\r
84 threads->doc_id_pos);
\r