stagit

git site generator
Contents

use LEN() macros for arrays

from Augustin Fabre 

Hiltjo Posthuma hiltjo@codemadness.org

commit: 989aaa9 parent: 71e7f0f
1 files changed, 4 insertions(+), 2 deletions(-)
Mstagit.c+4-2
M · stagit.c +4, -2
 1@@ -16,6 +16,8 @@
 2
 3 #include
"compat.h"
 4
 5+#define LEN(s) (sizeof(s)/sizeof(*s))
 6+
 7 struct deltainfo {
 8 git_patch *patch;
 9
10@@ -1230,7 +1232,7 @@ main(int argc, char *argv[])
11 }
12
13 /* check LICENSE
*/
14- for (i = 0; i < sizeof(licensefiles) / sizeof(*licensefiles) && !license;
i++) {
15+ for (i = 0; i
< LEN(licensefiles) && !license; i++) {
16 if (!git_revparse_single(&obj, repo,
licensefiles[i]) &&
17
git_object_type(obj) == GIT_OBJ_BLOB)
18 license =
licensefiles[i] + strlen("HEAD:");
19@@ -1238,7 +1240,7 @@ main(int argc, char *argv[])
20 }
21
22 /* check README
*/
23- for (i = 0; i < sizeof(readmefiles) / sizeof(*readmefiles) && !readme;
i++) {
24+ for (i = 0; i
< LEN(readmefiles) && !readme; i++) {
25 if (!git_revparse_single(&obj, repo,
readmefiles[i]) &&
26
git_object_type(obj) == GIT_OBJ_BLOB)
27 readme =
readmefiles[i] + strlen("HEAD:");