From daaea808956e36fdf17d695ae2bf6890a8c543b6 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 14 Oct 2023 18:56:25 +0300 Subject: [PATCH] (strip_ext): refactor loop. Signed-off-by: Andrew Borodin --- src/usermenu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/usermenu.c b/src/usermenu.c index c32887182..8e0c9286c 100644 --- a/src/usermenu.c +++ b/src/usermenu.c @@ -86,19 +86,20 @@ static char *menu = NULL; static char * strip_ext (char *ss) { - char *s = ss; + char *s; char *e = NULL; - while (*s != '\0') + for (s = ss; *s != '\0'; s++) { if (*s == '.') e = s; if (IS_PATH_SEP (*s) && e != NULL) e = NULL; /* '.' in *directory* name */ - s++; } + if (e != NULL) *e = '\0'; + return ss; }