]> granicus.if.org Git - neomutt/commitdiff
mutt_str_startswith - config/sort.c
authorPietro Cerutti <gahr@gahr.ch>
Fri, 9 Nov 2018 13:43:48 +0000 (13:43 +0000)
committerRichard Russon <rich@flatcap.org>
Wed, 14 Nov 2018 15:10:31 +0000 (15:10 +0000)
config/sort.c

index bf13c134352d2188962e832b169aba3cdabe1d47..ebc2d0f25234d6ad7e614af1d0e8d605eb698830 100644 (file)
@@ -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)
   {