git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Kuleshov <kuleshovmail@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git <git@vger.kernel.org>, Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: [PATCH] help.c: strip suffix only if the STRIP_EXTENSION defined
Date: Wed, 16 Mar 2016 20:27:29 +0600	[thread overview]
Message-ID: <1458138449-26690-1-git-send-email-kuleshovmail@gmail.com> (raw)

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

             reply	other threads:[~2016-03-16 14:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 14:27 Alexander Kuleshov [this message]
2016-03-16 14:47 ` [PATCH] help.c: strip suffix only if the STRIP_EXTENSION defined 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458138449-26690-1-git-send-email-kuleshovmail@gmail.com \
    --to=kuleshovmail@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).