Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 8d / 9f14f8025226d33cbdd7b8a5305bf5d29b3d15
1 Return-Path: <jani@nikula.org>\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 arlo.cworth.org (Postfix) with ESMTP id 8B3796DE0C3A\r
6  for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 09:48:43 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.513\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.513 tagged_above=-999 required=5 tests=[AWL=0.207,\r
12   RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]\r
13  autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id I0Zcjhcw11WQ for <notmuch@notmuchmail.org>;\r
17  Fri, 25 Sep 2015 09:48:41 -0700 (PDT)\r
18 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
19  [209.85.212.173])\r
20  by arlo.cworth.org (Postfix) with ESMTPS id 5D2736DE025E\r
21  for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 09:48:41 -0700 (PDT)\r
22 Received: by wiclk2 with SMTP id lk2so29885597wic.0\r
23  for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 09:48:39 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25  d=1e100.net; s=20130820;\r
26  h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\r
27  :references;\r
28  bh=1NDdt0CrFsdCyf6Od/6ni1a1RTGcud64elm99YDXTCM=;\r
29  b=gFSvl17MwDK2yRAJ40EIcm9goPL+/wrbERvNarJnN9cf0CM+v152ud8v0shVfe0H9C\r
30  0rnaAQEimh+SowLGrhZySNx4Sjbnhf0tSg1MSYmmH2UF5SmHwAXlCGkdroBUh1QpsCT6\r
31  JnSYHNZW43xoSxH9ydQbbAjPrMENk2KPxkBvuK7gsB3NuY9HK8DzxqRPSl6BAsIpPkTO\r
32  VA3HvEcpVoa1KKNvTS0ZZ3nUvnfq+iteiRc+JaIgfVvTr0fROiUgQaN99+1AeBsXc0z9\r
33  q6OP2xtRzZXjRaZyBD6Y/6vzeOtCOJlfaIkSNxDbKQ7KtgMj4KUOCuBw4sHyr1mTrdK4\r
34  ZL1w==\r
35 X-Gm-Message-State:\r
36  ALoCoQlPCnJ2QCVYbdGk31ZlJLHzEI1Iay1FU2vi5obHVRmvbMRP30rS5xTt1vEhqitdoEZ0NHHC\r
37 X-Received: by 10.194.115.199 with SMTP id jq7mr7964818wjb.82.1443199719657;\r
38  Fri, 25 Sep 2015 09:48:39 -0700 (PDT)\r
39 Received: from localhost (mobile-access-bcee63-221.dhcp.inet.fi.\r
40  [188.238.99.221])\r
41  by smtp.gmail.com with ESMTPSA id x7sm4081902wia.10.2015.09.25.09.48.38\r
42  (version=TLSv1/SSLv3 cipher=OTHER);\r
43  Fri, 25 Sep 2015 09:48:38 -0700 (PDT)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: David Bremner <david@tethera.net>, Jani Nikula <jani@nikula.org>,\r
46  notmuch@notmuchmail.org\r
47 Subject: [PATCH 6/9 v3 part 1/2] util: add strcmp_null,\r
48  a strcmp that handles NULL parameters\r
49 Date: Fri, 25 Sep 2015 19:48:19 +0300\r
50 Message-Id: <1443199700-16654-1-git-send-email-jani@nikula.org>\r
51 X-Mailer: git-send-email 2.1.4\r
52 In-Reply-To: <878u7v2y3x.fsf@zancas.localnet>\r
53 References: <878u7v2y3x.fsf@zancas.localnet>\r
54 X-BeenThere: notmuch@notmuchmail.org\r
55 X-Mailman-Version: 2.1.18\r
56 Precedence: list\r
57 List-Id: "Use and development of the notmuch mail system."\r
58  <notmuch.notmuchmail.org>\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
60  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
62 List-Post: <mailto:notmuch@notmuchmail.org>\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
65  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
66 X-List-Received-Date: Fri, 25 Sep 2015 16:48:43 -0000\r
67 \r
68 Add strcmp_null, a strcmp that handles NULL strings; in strcmp terms a\r
69 NULL string is considered to be less than a non-NULL string.\r
70 ---\r
71  util/string-util.c | 13 +++++++++++++\r
72  util/string-util.h |  5 +++++\r
73  2 files changed, 18 insertions(+)\r
74 \r
75 diff --git a/util/string-util.c b/util/string-util.c\r
76 index 76c0b9025d0f..92af937f45ec 100644\r
77 --- a/util/string-util.c\r
78 +++ b/util/string-util.c\r
79 @@ -223,6 +223,19 @@ parse_boolean_term (void *ctx, const char *str,\r
80  }\r
81  \r
82  int\r
83 +strcmp_null (const char *s1, const char *s2)\r
84 +{\r
85 +    if (s1 && s2)\r
86 +       return strcmp (s1, s2);\r
87 +    else if (! s1 && ! s2)\r
88 +       return 0;\r
89 +    else if (s1)\r
90 +       return 1;       /* s1 (non-NULL) is greater than s2 (NULL) */\r
91 +    else\r
92 +       return -1;      /* s1 (NULL) is less than s2 (non-NULL) */\r
93 +}\r
94 +\r
95 +int\r
96  strcase_equal (const void *a, const void *b)\r
97  {\r
98      return strcasecmp (a, b) == 0;\r
99 diff --git a/util/string-util.h b/util/string-util.h\r
100 index 80d24d1c1053..87917b8fd279 100644\r
101 --- a/util/string-util.h\r
102 +++ b/util/string-util.h\r
103 @@ -64,6 +64,11 @@ int\r
104  parse_boolean_term (void *ctx, const char *str,\r
105                     char **prefix_out, char **term_out);\r
106  \r
107 +/* strcmp that handles NULL strings; in strcmp terms a NULL string is\r
108 + * considered to be less than a non-NULL string.\r
109 + */\r
110 +int strcmp_null (const char *s1, const char *s2);\r
111 +\r
112  /* GLib GEqualFunc compatible strcasecmp wrapper */\r
113  int strcase_equal (const void *a, const void *b);\r
114  \r
115 -- \r
116 2.1.4\r
117 \r