From 83a2b841d6b90e6f4b797df40ed3a105364574b6 Mon Sep 17 00:00:00 2001 From: Rene Scharfe Date: Thu, 10 Aug 2006 17:02:30 +0200 Subject: Add has_extension() The little helper has_extension() documents through its name what we are trying to do and makes sure we don't forget the underrun check. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- local-fetch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'local-fetch.c') diff --git a/local-fetch.c b/local-fetch.c index 4bf86fbbe2..b6ec170c01 100644 --- a/local-fetch.c +++ b/local-fetch.c @@ -43,8 +43,8 @@ static int setup_indices(void) return -1; while ((de = readdir(dir)) != NULL) { int namelen = strlen(de->d_name); - if (namelen != 50 || - strcmp(de->d_name + namelen - 5, ".pack")) + if (namelen != 50 || + !has_extension(de->d_name, namelen, ".pack")) continue; get_sha1_hex(de->d_name + 5, sha1); setup_index(sha1); -- cgit v1.2.3