git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] help.c: strip suffix only if the STRIP_EXTENSION defined
@ 2016-03-16 14:27 Alexander Kuleshov
  2016-03-16 14:47 ` Duy Nguyen
  2016-03-16 17:31 ` Jeff King
  0 siblings, 2 replies; 6+ messages in thread
From: Alexander Kuleshov @ 2016-03-16 14:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git, Alexander Kuleshov

We stripping extension in the list_commands_in_dir() to get
commands without '.exe' suffix. Let's do it only if STRIP_EXTENSION
is defined to not spend time for unnecessary strip_suffix() call in
this case.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 help.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/help.c b/help.c
index 19328ea..c865991 100644
--- a/help.c
+++ b/help.c
@@ -153,8 +153,9 @@ static void list_commands_in_dir(struct cmdnames *cmds,
 			continue;
 
 		entlen = strlen(ent);
-		strip_suffix(ent, ".exe", &entlen);
-
+#ifdef STRIP_EXTENSION
+		strip_suffix(ent, STRIP_EXTENSION, &entlen);
+#endif
 		add_cmdname(cmds, ent, entlen);
 	}
 	closedir(dir);
-- 
2.8.0.rc2.216.g1477fb2.dirty

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-16 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16 14:27 [PATCH] help.c: strip suffix only if the STRIP_EXTENSION defined Alexander Kuleshov
2016-03-16 14:47 ` Duy Nguyen
2016-03-16 16:20   ` Alexander Kuleshov
2016-03-16 17:31 ` Jeff King
2016-03-16 17:36   ` Alexander Kuleshov
2016-03-16 17:39     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).