Introduction
Introduction Statistics Contact Development Disclaimer Help
rename line to linenr, count from 1 - saait - the most boring static page gener…
git clone git://git.codemadness.org/saait
Log
Files
Refs
README
LICENSE
---
commit 8b073bb76dcaad5e7029405e91918108e86f2b86
parent e75d8cfb365e36512e26cc62f6246d1dcd8500e1
Author: Hiltjo Posthuma <[email protected]>
Date: Sun, 5 Jan 2020 23:42:02 +0100
rename line to linenr, count from 1
Diffstat:
M saait.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/saait.c b/saait.c
@@ -218,11 +218,11 @@ parsevars(const char *file, const char *s)
{
struct variable *vars = NULL, *v;
const char *keystart, *keyend, *valuestart, *valueend;
- size_t line = 0;
+ size_t linenr = 1;
for (; *s; ) {
if (*s == '\r' || *s == '\n') {
- line += (*s == '\n');
+ linenr += (*s == '\n');
s++;
continue;
}
@@ -241,7 +241,7 @@ parsevars(const char *file, const char *s)
s = &s[strcspn(s, "=\r\n")];
if (*s != '=') {
fprintf(stderr, "%s:%zu: error: no variable\n",
- file, line + 1);
+ file, linenr);
exit(1);
}
@@ -254,7 +254,7 @@ parsevars(const char *file, const char *s)
/* no variable name: skip */
if (keystart == keyend) {
fprintf(stderr, "%s:%zu: error: invalid variable\n",
- file, line + 1);
+ file, linenr);
exit(1);
}
@@ -308,7 +308,7 @@ writepage(FILE *fp, const char *name, struct variable *c, c…
FILE *fpin;
struct variable *v;
char *key;
- size_t keylen, line = 0;
+ size_t keylen, linenr = 1;
int op, tmpc;
for (; *s; s++) {
@@ -324,7 +324,7 @@ writepage(FILE *fp, const char *name, struct variable *c, c…
fputc(*s, fp);
continue;
case '\n':
- line++; /* FALLTHROUGH */
+ linenr++; /* FALLTHROUGH */
default:
fputc(*s, fp);
continue;
@@ -352,7 +352,7 @@ writepage(FILE *fp, const char *name, struct variable *c, c…
if (!v) {
fprintf(stderr, "%s:%zu: error: undefined variable: '%…
- name, line + 1, (int)keylen, key);
+ name, linenr, (int)keylen, key);
exit(1);
}
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.