unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Replace index(3) with strchr(3)
@ 2017-04-06 23:06 Fredrik Fornwall
  2017-05-07 11:54 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: Fredrik Fornwall @ 2017-04-06 23:06 UTC (permalink / raw)
  To: notmuch

The index(3) function has been deprecated in POSIX since 2001 and
removed in 2008, and most code in notmuch already calls strchr(3).

This fixes a compilation error on Android whose libc does not have
index(3).
---
 lib/message-property.cc | 2 +-
 lib/message.cc          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/message-property.cc b/lib/message-property.cc
index 0b13cac..f32d555 100644
--- a/lib/message-property.cc
+++ b/lib/message-property.cc
@@ -51,7 +51,7 @@ _notmuch_message_modify_property (notmuch_message_t *message, const char *key, c
     if (key == NULL || value == NULL)
 	return NOTMUCH_STATUS_NULL_POINTER;
 
-    if (index (key, '='))
+    if (strchr (key, '='))
 	return NOTMUCH_STATUS_ILLEGAL_ARGUMENT;
 
     term = talloc_asprintf (message, "%s=%s", key, value);
diff --git a/lib/message.cc b/lib/message.cc
index f8215a4..c272119 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1843,7 +1843,7 @@ _notmuch_message_ensure_property_map (notmuch_message_t *message)
 	const char *key;
 	char *value;
 
-	value = index(node->string, '=');
+	value = strchr(node->string, '=');
 	if (!value)
 	    INTERNAL_ERROR ("malformed property term");
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Replace index(3) with strchr(3)
  2017-04-06 23:06 [PATCH] Replace index(3) with strchr(3) Fredrik Fornwall
@ 2017-05-07 11:54 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2017-05-07 11:54 UTC (permalink / raw)
  To: Fredrik Fornwall, notmuch; +Cc: notmuch

Fredrik Fornwall <fredrik@fornwall.net> writes:

> The index(3) function has been deprecated in POSIX since 2001 and
> removed in 2008, and most code in notmuch already calls strchr(3).
>

pushed to master (some time ago)

d

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-07 11:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06 23:06 [PATCH] Replace index(3) with strchr(3) Fredrik Fornwall
2017-05-07 11:54 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).