]> granicus.if.org Git - neomutt/commitdiff
Replace `try` variable with `user`
authorFederico Kircheis <federico.kircheis@gmail.com>
Sat, 29 Jun 2019 12:11:54 +0000 (14:11 +0200)
committerRichard Russon <rich@flatcap.org>
Fri, 5 Jul 2019 01:03:47 +0000 (02:03 +0100)
`try` is a keyword in c++

While this should not affect C code, it affects unfortunately the
tooling.

This specific instance triggers a "syntax error" in Cppcheck, so it
could hide other problems.

(Cppcheck version  1.86, code parsed with `--language=c --std=c99`)

Of course it is a bug in Cppcheck, but renaming the variable is the most
pragmatic approach, as the bug in Cppcheck does not manifest itself in
a simple program.

init.c

diff --git a/init.c b/init.c
index c10d301584051b2b8b81c44b0931526f0dea3ece..04dddc5cdb1f46b0e6a8f6708c5b8e4ff9aa45d3 100644 (file)
--- a/init.c
+++ b/init.c
@@ -177,19 +177,19 @@ static void matches_ensure_morespace(int current)
 
 /**
  * candidate - helper function for completion
- * @param try  User entered data for completion
+ * @param user User entered data for completion
  * @param src  Candidate for completion
  * @param dest Completion result gets here
  * @param dlen Length of dest buffer
  *
  * Changes the dest buffer if necessary/possible to aid completion.
  */
-static void candidate(char *try, const char *src, char *dest, size_t dlen)
+static void candidate(char *user, const char *src, char *dest, size_t dlen)
 {
-  if (!dest || !try || !src)
+  if (!dest || !user || !src)
     return;
 
-  if (strstr(src, try) != src)
+  if (strstr(src, user) != src)
     return;
 
   matches_ensure_morespace(NumMatched);