From 8889138fbff4c7aa5b8fb0ff7806ae5f08e39dcc Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Fri, 9 Nov 2018 13:43:48 +0000 Subject: [PATCH] mutt_str_startswith - config/sort.c --- config/sort.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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) { -- 2.49.0