aboutsummaryrefslogtreecommitdiff
path: root/builtin-help.c
diff options
context:
space:
mode:
authorRene Scharfe <rene.scharfe@lsrfire.ath.cx>2006-08-11 14:01:45 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-11 16:06:34 -0700
commit5bb1cda5f73988963e7470f3cd75a380751f6d99 (patch)
tree550b8a6f962d816b7fa0e796d1c5d1f4037d0375 /builtin-help.c
parentca9e3b124f6313187da641b5cd55100c4ade6a9a (diff)
downloadgit-5bb1cda5f73988963e7470f3cd75a380751f6d99.tar.gz
git-5bb1cda5f73988963e7470f3cd75a380751f6d99.tar.xz
drop length argument of has_extension
As Fredrik points out the current interface of has_extension() is potentially confusing. Its parameters include both a nul-terminated string and a length-limited string. This patch drops the length argument, requiring two nul-terminated strings; all callsites are updated. I checked that all of them indeed provide nul-terminated strings. Filenames need to be nul-terminated anyway if they are to be passed to open() etc. The performance penalty of the additional strlen() is negligible compared to the system calls which inevitably surround has_extension() calls. Additionally, change has_extension() to use size_t inside instead of int, as that is the exact type strlen() returns and memcmp() expects. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-help.c')
-rw-r--r--builtin-help.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-help.c b/builtin-help.c
index 7a7f7759e..6484cb9df 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -140,7 +140,7 @@ static void list_commands(const char *exec_path, const char *pattern)
continue;
entlen = strlen(de->d_name);
- if (has_extension(de->d_name, entlen, ".exe"))
+ if (has_extension(de->d_name, ".exe"))
entlen -= 4;
if (longest < entlen)