aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiltjo Posthuma <[email protected]>2020-11-15 20:58:02 +0100
committerHiltjo Posthuma <[email protected]>2020-11-15 20:58:02 +0100
commit3e7865f8f9ef87f622a7a94e7ae70355753ee66a (patch)
tree900621754afc6bcdc505f67eea732b10295fbd03
parent75555cd99ee4d5df765f7dd6f0d09f2f925be725 (diff)
downloadstagit-3e7865f8f9ef87f622a7a94e7ae70355753ee66a.tar.gz
stagit-3e7865f8f9ef87f622a7a94e7ae70355753ee66a.zip
use LEN() macros for arrays
from Augustin Fabre <[email protected]>
-rw-r--r--stagit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/stagit.c b/stagit.c
index d9e80a1..f1dd745 100644
--- 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:");