From 79f971e5f7cb6c69d1b2ed2d38a5bccd604a24f5 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Fri, 27 Feb 2009 09:39:40 +0000 Subject: Lintified sources. --- Makefile | 5 ++++- action.c | 8 ++++---- argv.c | 6 +++--- macro.c | 15 ++++++++++----- term.c | 5 +++-- validate.c | 13 +++++++------ 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index c4e2686c..9ce3deae 100644 --- a/Makefile +++ b/Makefile @@ -128,6 +128,9 @@ lint: $(LLNS) clean: rm -f $(CLEAN) +cleanlint: + rm -f $(LNS) $(LLNS) + dist: mdocml-$(VERSION).tar.gz port: mdocml-oport-$(VERSION).tar.gz @@ -141,7 +144,7 @@ installwww: www install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz -regress:: +regress: mdoclint @for f in $(FAIL); do \ echo "./mdoclint $$f" ; \ ./mdoclint $$f 2>/dev/null || continue ; exit 1 ; done diff --git a/action.c b/action.c index 6197675a..a6599ae2 100644 --- a/action.c +++ b/action.c @@ -285,8 +285,8 @@ static int post_bl(struct mdoc *mdoc) { struct mdoc_block *bl; - size_t i, width; - int tok; + size_t width; + int tok, i; char buf[32]; if (MDOC_BLOCK != mdoc->last->type) @@ -294,11 +294,11 @@ post_bl(struct mdoc *mdoc) bl = &mdoc->last->data.block; - for (i = 0; i < bl->argc; i++) + for (i = 0; i < (int)bl->argc; i++) if (MDOC_Width == bl->argv[i].arg) break; - if (i == bl->argc) + if (i == (int)bl->argc) return(1); assert(1 == bl->argv[i].sz); diff --git a/argv.c b/argv.c index ca05354a..01dba107 100644 --- a/argv.c +++ b/argv.c @@ -372,7 +372,7 @@ args(struct mdoc *mdoc, int line, p++; if (0 != *p) *(p - 1) = 0; - *pos += p - *v; + *pos += (int)(p - *v); } if (p && 0 == *p) @@ -393,7 +393,7 @@ args(struct mdoc *mdoc, int line, if (p > *v && ' ' == *(p - 1)) if ( ! pwarn(mdoc, line, *pos, WTAILWS)) return(0); - *pos += p - *v; + *pos += (int)(p - *v); return(ARGS_WORD); } @@ -647,7 +647,7 @@ argv_multi(struct mdoc *mdoc, int line, return(0); } else if (ARGS_EOLN == c) break; - v->value[v->sz] = p; + v->value[(int)v->sz] = p; } if (0 < v->sz && v->sz < MDOC_LINEARG_MAX) diff --git a/macro.c b/macro.c index 4b2caf26..36853680 100644 --- a/macro.c +++ b/macro.c @@ -750,7 +750,8 @@ macro_text(MACRO_PROT_ARGS) return(perr(mdoc, line, ppos, EARGVLIM)); } - c = mdoc_elem_alloc(mdoc, line, ppos, tok, argc, argv); + c = mdoc_elem_alloc(mdoc, line, ppos, + tok, (size_t)argc, argv); if (0 == c) { mdoc_argv_free(argc, argv); @@ -802,8 +803,8 @@ macro_text(MACRO_PROT_ARGS) } lastpunct = 1; } else if (lastpunct) { - c = mdoc_elem_alloc(mdoc, line, - ppos, tok, argc, argv); + c = mdoc_elem_alloc(mdoc, line, ppos, + tok, (size_t)argc, argv); if (0 == c) { mdoc_argv_free(argc, argv); return(0); @@ -1225,7 +1226,9 @@ macro_constant_delimited(MACRO_PROT_ARGS) return(perr(mdoc, line, ppos, EARGVLIM)); } - c = mdoc_elem_alloc(mdoc, line, ppos, tok, argc, argv); + c = mdoc_elem_alloc(mdoc, line, ppos, + tok, (size_t)argc, argv); + mdoc_argv_free(argc, argv); if (0 == c) @@ -1316,7 +1319,9 @@ macro_constant(MACRO_PROT_ARGS) return(perr(mdoc, line, ppos, EARGVLIM)); } - c = mdoc_elem_alloc(mdoc, line, ppos, tok, argc, argv); + c = mdoc_elem_alloc(mdoc, line, ppos, + tok, (size_t)argc, argv); + mdoc_argv_free(argc, argv); if (0 == c) diff --git a/term.c b/term.c index 4a9e93d1..668d4709 100644 --- a/term.c +++ b/term.c @@ -277,7 +277,8 @@ const struct termact *termacts = __termacts; static size_t arg_width(const struct mdoc_arg *arg) { - size_t len, i, v; + size_t v; + int i, len; assert(*arg->value); if (0 == strcmp(*arg->value, "indent")) @@ -285,7 +286,7 @@ arg_width(const struct mdoc_arg *arg) if (0 == strcmp(*arg->value, "indent-two")) return(INDENT * 2); - len = strlen(*arg->value); + len = (int)strlen(*arg->value); assert(len > 0); for (i = 0; i < len - 1; i++) diff --git a/validate.c b/validate.c index bafe9ce3..0a5fb8f3 100644 --- a/validate.c +++ b/validate.c @@ -52,7 +52,7 @@ static int check_msec(PRE_ARGS, int, enum mdoc_msec *); static int check_stdarg(PRE_ARGS); static int check_text(struct mdoc *, - size_t, size_t, const char *); + int, int, const char *); static int err_child_lt(struct mdoc *, const char *, int); static int warn_child_lt(struct mdoc *, const char *, int); @@ -278,7 +278,8 @@ mdoc_valid_pre(struct mdoc *mdoc, { v_pre *p; struct mdoc_arg *argv; - size_t argc, i, j, line, pos; + size_t argc; + int line, pos, i, j; const char *tp; if (MDOC_TEXT == node->type) { @@ -296,10 +297,10 @@ mdoc_valid_pre(struct mdoc *mdoc, node->data.block.argc : node->data.elem.argc; - for (i = 0; i < argc; i++) { + for (i = 0; i < (int)argc; i++) { if (0 == argv[i].sz) continue; - for (j = 0; j < argv[i].sz; j++) { + for (j = 0; j < (int)argv[i].sz; j++) { tp = argv[i].value[j]; line = argv[i].line; pos = argv[i].pos; @@ -476,7 +477,7 @@ check_msec(PRE_ARGS, int sz, enum mdoc_msec *msecs) static int -check_text(struct mdoc *mdoc, size_t line, size_t pos, const char *p) +check_text(struct mdoc *mdoc, int line, int pos, const char *p) { size_t c; @@ -489,7 +490,7 @@ check_text(struct mdoc *mdoc, size_t line, size_t pos, const char *p) if ('\\' != *p) continue; if ((c = mdoc_isescape(p))) { - p += (c - 1); + p += (int)c - 1; continue; } return(mdoc_perr(mdoc, line, pos, -- cgit