stagit
static git repository generator
git clone https://9o.is/git/stagit.git
commit cffa6b13c8be40c12cd628eac75c5615352952b1 parent 7b05e41107e462215a79138a05a6988e947f8044 Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sun, 15 Nov 2020 20:58:02 +0100 use LEN() macros for arrays from Augustin Fabre <augustin@augfab.fr> Diffstat:
| M | stagit.c | | | 6 | ++++-- |
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/stagit.c b/stagit.c @@ -16,6 +16,8 @@ #include "compat.h" +#define LEN(s) (sizeof(s)/sizeof(*s)) + struct deltainfo { git_patch *patch; @@ -1230,7 +1232,7 @@ main(int argc, char *argv[]) } /* check LICENSE */ - for (i = 0; i < sizeof(licensefiles) / sizeof(*licensefiles) && !license; i++) { + for (i = 0; i < LEN(licensefiles) && !license; i++) { if (!git_revparse_single(&obj, repo, licensefiles[i]) && git_object_type(obj) == GIT_OBJ_BLOB) license = licensefiles[i] + strlen("HEAD:"); @@ -1238,7 +1240,7 @@ main(int argc, char *argv[]) } /* check README */ - for (i = 0; i < sizeof(readmefiles) / sizeof(*readmefiles) && !readme; i++) { + for (i = 0; i < LEN(readmefiles) && !readme; i++) { if (!git_revparse_single(&obj, repo, readmefiles[i]) && git_object_type(obj) == GIT_OBJ_BLOB) readme = readmefiles[i] + strlen("HEAD:");