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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
committed by
Junio C Hamano
parent
242abf106c
commit
83a2b841d6
@ -447,7 +447,7 @@ int main(int argc, char **argv)
|
||||
usage(index_pack_usage);
|
||||
if (!index_name) {
|
||||
int len = strlen(pack_name);
|
||||
if (len < 5 || strcmp(pack_name + len - 5, ".pack"))
|
||||
if (!has_extension(pack_name, len, ".pack"))
|
||||
die("packfile name '%s' does not end with '.pack'",
|
||||
pack_name);
|
||||
index_name_buf = xmalloc(len);
|
||||
|
||||
Reference in New Issue
Block a user