commit 23c62c50328363d713692f24183d7e7509baf22f
parent 2770ec81e2a543f3924027cac9db87773c73afcf
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 18 Jun 2020 11:17:06 +0200
tweaks: drop two unneeded assignments
The variable is set to zero at its declaration, and the second function
is called only when the first is either not called or found nothing --
thus '*num_matches' will still be zero.
Diffstat:
1 file changed, 0 insertions(+), 5 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -2388,11 +2388,7 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
char **matches = NULL;
#ifdef HAVE_PWD_H
const struct passwd *userdata;
-#endif
-
- *num_matches = 0;
-#ifdef HAVE_PWD_H
while ((userdata = getpwent()) != NULL) {
if (strncmp(userdata->pw_name, buf + 1, buf_len - 1) == 0) {
/* Cool, found a match. Add it to the list. This makes a
@@ -2430,7 +2426,6 @@ char **cwd_tab_completion(const char *buf, bool allow_files,
DIR *dir;
const struct dirent *nextdir;
- *num_matches = 0;
dirname[buf_len] = '\0';
/* If there's a / in the name, split out filename and directory parts. */