diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2013-10-05 21:17:30 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2013-10-05 21:17:30 +0000 |
commit | 9d604b95c2e9970402cf060ad8dacec60b1de047 (patch) | |
tree | 0e56a9de96a966e8df2bd57b7672e00d776914bc | |
parent | c29d06141fbdb9137c7bafd5adfd2b39ca799c44 (diff) |
Cleanup suggested by gcc-4.8.1, following hints by Christos Zoulas:
- avoid bad qualifier casting in roff.c, roff_parsetext()
by changing the mandoc_escape arguments to "const char const **"
- avoid bad qualifier casting in mandocdb.c, index_merge()
- garbage collect a few unused variables elsewhere
-rw-r--r-- | usr.bin/mandoc/apropos_db.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/mandocdb.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/out.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/roff.c | 4 |
6 files changed, 14 insertions, 15 deletions
diff --git a/usr.bin/mandoc/apropos_db.c b/usr.bin/mandoc/apropos_db.c index 5b47567e0b4..6c2c0c638c3 100644 --- a/usr.bin/mandoc/apropos_db.c +++ b/usr.bin/mandoc/apropos_db.c @@ -1,4 +1,4 @@ -/* $Id: apropos_db.c,v 1.18 2012/04/15 11:54:47 schwarze Exp $ */ +/* $Id: apropos_db.c,v 1.19 2013/10/05 21:17:29 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -401,11 +401,10 @@ apropos_search(int pathsz, char **paths, const struct opts *opts, { struct rectree tree; struct mchars *mc; - int i, rc; + int i; memset(&tree, 0, sizeof(struct rectree)); - rc = 0; mc = mchars_alloc(); *sz = 0; *resp = NULL; diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c index 829561afbe2..f24da3895e8 100644 --- a/usr.bin/mandoc/mandoc.c +++ b/usr.bin/mandoc/mandoc.c @@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.37 2013/08/08 20:07:24 schwarze Exp $ */ +/* $Id: mandoc.c,v 1.38 2013/10/05 21:17:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -36,7 +36,7 @@ static char *time2a(time_t); enum mandoc_esc -mandoc_escape(const char **end, const char **start, int *sz) +mandoc_escape(const char const **end, const char const **start, int *sz) { const char *local_start; int local_sz; diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 6cf0d6a6382..134f2e33a28 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.54 2013/09/16 00:25:06 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.55 2013/10/05 21:17:29 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -400,7 +400,8 @@ struct man; __BEGIN_DECLS void *mandoc_calloc(size_t, size_t); -enum mandoc_esc mandoc_escape(const char **, const char **, int *); +enum mandoc_esc mandoc_escape(const char const **, + const char const **, int *); void *mandoc_malloc(size_t); void *mandoc_realloc(void *, size_t); char *mandoc_strdup(const char *); diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index a09d7b845a2..c5110e4b418 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.44 2013/06/05 02:02:53 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.45 2013/10/05 21:17:29 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -602,6 +602,8 @@ index_merge(const struct of *of, struct mparse *mp, uint64_t vbuf[2]; char type; + static char emptystring[] = ""; + if (warnings) { files = NULL; hash_reset(&files); @@ -720,7 +722,7 @@ index_merge(const struct of *of, struct mparse *mp, val.data = NULL; val.size = 0; if (0 == skip) - val.data = ""; + val.data = emptystring; else { ch = (*files->get)(files, &key, &val, 0); if (ch < 0) { diff --git a/usr.bin/mandoc/out.c b/usr.bin/mandoc/out.c index b1fd85a68c4..ff927116310 100644 --- a/usr.bin/mandoc/out.c +++ b/usr.bin/mandoc/out.c @@ -1,4 +1,4 @@ -/* $Id: out.c,v 1.18 2013/05/31 21:37:09 schwarze Exp $ */ +/* $Id: out.c,v 1.19 2013/10/05 21:17:29 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -138,7 +138,6 @@ void tblcalc(struct rofftbl *tbl, const struct tbl_span *sp) { const struct tbl_dat *dp; - const struct tbl_head *hp; struct roffcol *col; int spans; @@ -152,8 +151,6 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp) tbl->cols = mandoc_calloc ((size_t)sp->opts->cols, sizeof(struct roffcol)); - hp = sp->head; - for ( ; sp; sp = sp->next) { if (TBL_SPAN_DATA != sp->pos) continue; diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index f5a4494d89b..c9e7832ca88 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.56 2013/10/04 02:01:58 schwarze Exp $ */ +/* $Id: roff.c,v 1.57 2013/10/05 21:17:29 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -639,7 +639,7 @@ roff_parsetext(char **bufp, size_t *szp, int pos, int *offs) /* Skip over escapes. */ p++; esc = mandoc_escape - ((const char **)&p, NULL, NULL); + ((const char const **)&p, NULL, NULL); if (ESCAPE_ERROR == esc) break; continue; |