database error
[notmuch-archives.git] / 95 / 25757a09920b262ef0f1b468ceddfabb02fb58
1 Return-Path: <novalazy@gmail.com>\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 C3259431FAE\r
6         for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 17:17:16 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 9hR5Ew+RisLC for <notmuch@notmuchmail.org>;\r
17         Sat, 24 Nov 2012 17:17:16 -0800 (PST)\r
18 Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com\r
19         [209.85.160.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 392ED431FBD\r
22         for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 17:17:16 -0800 (PST)\r
23 Received: by mail-pb0-f53.google.com with SMTP id jt11so7944513pbb.26\r
24         for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 17:17:15 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
27         bh=VlIljfmxJjPfuWpmcWLotjw/BjiP2vefwPdyBkrjMgU=;\r
28         b=n9tFiGmSrm0vDb2++99f4yhBOjREUxG/bLPTO4feSMov8T3A6FGx7fQcOA9Ryy5wSk\r
29         +aP/CkJApkOAmdKNuJ/xdHtcjmQCeOhlWNOt1Rq1U+MZ2yc24zOrY+m/9JzWIvJ3wAZE\r
30         uuksT7BV0K3maIPDOJEjg2rzj2lP4B8xo3pE3b22Atb23PSRdfFlxF16q0IWBwREWBNw\r
31         UWNWVFg+7wDQKpv2HQz4rhd3cS3uFZ9fEHrWuTDVQ5ofR46zLHWL3fz5XpHYojGNF96X\r
32         cyDdMhLySH3J2bptY4oU3L207XLBkkoMXWVxJjdgFtfjty+FAxBFPYnJ50G2PT5Sgxel\r
33         ZFBA==\r
34 Received: by 10.66.72.71 with SMTP id b7mr21677109pav.28.1353806235475;\r
35         Sat, 24 Nov 2012 17:17:15 -0800 (PST)\r
36 Received: from localhost (215.42.233.220.static.exetel.com.au.\r
37         [220.233.42.215])\r
38         by mx.google.com with ESMTPS id ok8sm6224085pbb.42.2012.11.24.17.17.12\r
39         (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sat, 24 Nov 2012 17:17:14 -0800 (PST)\r
41 From: Peter Wang <novalazy@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH v2 02/20] tag: make tag operation parser public\r
44 Date: Sun, 25 Nov 2012 12:16:28 +1100\r
45 Message-Id: <1353806206-29133-3-git-send-email-novalazy@gmail.com>\r
46 X-Mailer: git-send-email 1.7.12.1\r
47 In-Reply-To: <1353806206-29133-1-git-send-email-novalazy@gmail.com>\r
48 References: <1353806206-29133-1-git-send-email-novalazy@gmail.com>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Sun, 25 Nov 2012 01:17:16 -0000\r
62 \r
63 Make the tag operation parser accessible outside notmuch-tag.c\r
64 so it can be reused by the upcoming insert command.\r
65 ---\r
66  notmuch-client.h |  9 +++++++++\r
67  notmuch-tag.c    | 17 ++++++-----------\r
68  2 files changed, 15 insertions(+), 11 deletions(-)\r
69 \r
70 diff --git a/notmuch-client.h b/notmuch-client.h\r
71 index ae9344b..a7c3df2 100644\r
72 --- a/notmuch-client.h\r
73 +++ b/notmuch-client.h\r
74 @@ -65,6 +65,11 @@ typedef GMimeCipherContext notmuch_crypto_context_t;\r
75  #define STRINGIFY(s) STRINGIFY_(s)\r
76  #define STRINGIFY_(s) #s\r
77  \r
78 +typedef struct {\r
79 +    const char *tag;\r
80 +    notmuch_bool_t remove;\r
81 +} notmuch_tag_operation_t;\r
82 +\r
83  typedef struct mime_node mime_node_t;\r
84  struct sprinter;\r
85  struct notmuch_show_params;\r
86 @@ -159,6 +164,10 @@ notmuch_cat_command (void *ctx, int argc, char *argv[]);\r
87  int\r
88  notmuch_config_command (void *ctx, int argc, char *argv[]);\r
89  \r
90 +int\r
91 +parse_tag_operations (int i, int argc, char *argv[],\r
92 +                     notmuch_tag_operation_t *tag_ops, int *tag_ops_count);\r
93 +\r
94  const char *\r
95  notmuch_time_relative_date (const void *ctx, time_t then);\r
96  \r
97 diff --git a/notmuch-tag.c b/notmuch-tag.c\r
98 index 35a76db..831a0e4 100644\r
99 --- a/notmuch-tag.c\r
100 +++ b/notmuch-tag.c\r
101 @@ -54,14 +54,9 @@ _escape_tag (char *buf, const char *tag)\r
102      return buf;\r
103  }\r
104  \r
105 -typedef struct {\r
106 -    const char *tag;\r
107 -    notmuch_bool_t remove;\r
108 -} tag_operation_t;\r
109 -\r
110  static char *\r
111  _optimize_tag_query (void *ctx, const char *orig_query_string,\r
112 -                    const tag_operation_t *tag_ops)\r
113 +                    const notmuch_tag_operation_t *tag_ops)\r
114  {\r
115      /* This is subtler than it looks.  Xapian ignores the '-' operator\r
116       * at the beginning both queries and parenthesized groups and,\r
117 @@ -116,7 +111,7 @@ _optimize_tag_query (void *ctx, const char *orig_query_string,\r
118   * element. */\r
119  static int\r
120  tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,\r
121 -          tag_operation_t *tag_ops, notmuch_bool_t synchronize_flags)\r
122 +          notmuch_tag_operation_t *tag_ops, notmuch_bool_t synchronize_flags)\r
123  {\r
124      notmuch_query_t *query;\r
125      notmuch_messages_t *messages;\r
126 @@ -170,9 +165,9 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,\r
127  /* Parse +tag and -tag operations between argv[i] and argv[argc-1].\r
128   * The array tag_ops must be at least argc - i elements long.\r
129   * Returns the index into argv where parsing stopped, or -1 on error. */\r
130 -static int\r
131 +int\r
132  parse_tag_operations (int i, int argc, char *argv[],\r
133 -                     tag_operation_t *tag_ops, int *tag_ops_count)\r
134 +                     notmuch_tag_operation_t *tag_ops, int *tag_ops_count)\r
135  {\r
136      *tag_ops_count = 0;\r
137  \r
138 @@ -207,7 +202,7 @@ parse_tag_operations (int i, int argc, char *argv[],\r
139  int\r
140  notmuch_tag_command (void *ctx, int argc, char *argv[])\r
141  {\r
142 -    tag_operation_t *tag_ops;\r
143 +    notmuch_tag_operation_t *tag_ops;\r
144      int tag_ops_count;\r
145      char *query_string;\r
146      notmuch_config_t *config;\r
147 @@ -228,7 +223,7 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])\r
148  \r
149      /* Array of tagging operations (add or remove), terminated with an\r
150       * empty element. */\r
151 -    tag_ops = talloc_array (ctx, tag_operation_t, argc + 1);\r
152 +    tag_ops = talloc_array (ctx, notmuch_tag_operation_t, argc + 1);\r
153      if (tag_ops == NULL) {\r
154         fprintf (stderr, "Out of memory.\n");\r
155         return 1;\r
156 -- \r
157 1.7.12.1\r
158 \r