]> git.notmuchmail.org Git - notmuch/commitdiff
Replace index(3) with strchr(3)
authorFredrik Fornwall <fredrik@fornwall.net>
Thu, 6 Apr 2017 23:06:20 +0000 (01:06 +0200)
committerDavid Bremner <david@tethera.net>
Thu, 20 Apr 2017 09:59:22 +0000 (06:59 -0300)
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
lib/message.cc

index 0b13cac314f9aad61067986257273af3a7921b3b..f32d555062d2bce0decf7cd5f9b33894655e7924 100644 (file)
@@ -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 (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);
        return NOTMUCH_STATUS_ILLEGAL_ARGUMENT;
 
     term = talloc_asprintf (message, "%s=%s", key, value);
index f8215a49f7dc93b482fb1d309b5ce8c68d6ba2f3..c2721191043e88e265a7920b89cc90b8a191719d 100644 (file)
@@ -1843,7 +1843,7 @@ _notmuch_message_ensure_property_map (notmuch_message_t *message)
        const char *key;
        char *value;
 
        const char *key;
        char *value;
 
-       value = index(node->string, '=');
+       value = strchr(node->string, '=');
        if (!value)
            INTERNAL_ERROR ("malformed property term");
 
        if (!value)
            INTERNAL_ERROR ("malformed property term");