commit 290b25014198aa51aad95803cde2b1e1c28428d4
parent b61d97eb9a167ba05f0d5b98461e741f1e779ff2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 18 Jun 2020 12:03:54 +0200
tweaks: elide an unneeded variable, as there is nothing beyond '*place'
Diffstat:
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -2513,12 +2513,8 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
/* If the word starts with `~' and there is no slash in the word,
* then try completing this word as a username. */
- if (*place > 0 && *buf == '~') {
- const char *slash = strchr(buf, '/');
-
- if (slash == NULL || slash >= buf + *place)
- matches = username_tab_completion(buf, &num_matches, *place);
- }
+ if (buf[0] == '~' && strchr(buf, '/') == NULL)
+ matches = username_tab_completion(buf, &num_matches, *place);
/* If nothing matched yet, match against filenames in current directory. */
if (matches == NULL)