From: Fredrik Fornwall Date: Thu, 6 Apr 2017 23:06:20 +0000 (+0200) Subject: Replace index(3) with strchr(3) X-Git-Tag: 0.25_rc0~78 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=e56511817284afc14352f47a13fcf85b2fabd628;ds=sidebyside Replace index(3) with strchr(3) 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). --- diff --git a/lib/message-property.cc b/lib/message-property.cc index 0b13cac3..f32d5550 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 f8215a49..c2721191 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");