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.
This commit is contained in:
Benno Schulenberg 2020-06-18 11:17:06 +02:00
parent 2770ec81e2
commit 23c62c5032

View File

@ -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. */