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).
This commit is contained in:
Fredrik Fornwall 2017-04-07 01:06:20 +02:00 committed by David Bremner
parent 0b76e4a6f4
commit e565118172
2 changed files with 2 additions and 2 deletions

View file

@ -51,7 +51,7 @@ _notmuch_message_modify_property (notmuch_message_t *message, const char *key, c
if (key == NULL || value == NULL) if (key == NULL || value == NULL)
return NOTMUCH_STATUS_NULL_POINTER; return NOTMUCH_STATUS_NULL_POINTER;
if (index (key, '=')) if (strchr (key, '='))
return NOTMUCH_STATUS_ILLEGAL_ARGUMENT; return NOTMUCH_STATUS_ILLEGAL_ARGUMENT;
term = talloc_asprintf (message, "%s=%s", key, value); term = talloc_asprintf (message, "%s=%s", key, value);

View file

@ -1843,7 +1843,7 @@ _notmuch_message_ensure_property_map (notmuch_message_t *message)
const char *key; const char *key;
char *value; char *value;
value = index(node->string, '='); value = strchr(node->string, '=');
if (!value) if (!value)
INTERNAL_ERROR ("malformed property term"); INTERNAL_ERROR ("malformed property term");