From: Pietro Cerutti Date: Fri, 9 Nov 2018 13:43:48 +0000 (+0000) Subject: mutt_str_startswith - config/sort.c X-Git-Tag: 2019-10-25~532^2~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8889138fbff4c7aa5b8fb0ff7806ae5f08e39dcc;p=neomutt mutt_str_startswith - config/sort.c --- diff --git a/config/sort.c b/config/sort.c index bf13c1343..ebc2d0f25 100644 --- a/config/sort.c +++ b/config/sort.c @@ -149,17 +149,16 @@ static int sort_string_set(const struct ConfigSet *cs, void *var, struct ConfigD return CSR_ERR_INVALID | CSR_INV_TYPE; } - if (mutt_str_strncmp("reverse-", value, 8) == 0) + size_t plen = 0; + if ((plen = mutt_str_startswith(value, "reverse-", CASE_MATCH))) { flags |= SORT_REVERSE; - value += 8; } - - if (mutt_str_strncmp("last-", value, 5) == 0) + else if ((plen = mutt_str_startswith(value, "last-", CASE_MATCH))) { flags |= SORT_LAST; - value += 5; } + value += plen; switch (cdef->type & DT_SUBTYPE_MASK) {