Introduction
Introduction Statistics Contact Development Disclaimer Help
use LEN() macros for arrays - stagit - static git page generator
git clone git://git.codemadness.org/stagit
Log
Files
Refs
README
LICENSE
---
commit 3e7865f8f9ef87f622a7a94e7ae70355753ee66a
parent 75555cd99ee4d5df765f7dd6f0d09f2f925be725
Author: Hiltjo Posthuma <[email protected]>
Date: Sun, 15 Nov 2020 20:58:02 +0100
use LEN() macros for arrays
from Augustin Fabre <[email protected]>
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) && !licen…
+ 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;…
+ 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:");
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.