diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-07-15 19:31:54 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-07-15 19:31:54 +0000 |
commit | 1b0af85581b890592138c1f4c8f4f10b37d2fede (patch) | |
tree | 8cfbe65f60ea86438e4190c726312bd55387f27b | |
parent | cb0b57aacc9a95c6893cf560e628a2a8fd3d9ac4 (diff) |
To remove the const qualifier from a pointer to an object - either
because we know it is actually mutable or because we are passing
it to a function that doesn't accept a const object but won't
actually attempt to modify it - simply casting from (const type *)
to (type *) is legal C and clearly expresses the intent.
So get rid of the obfuscating UNCONST macro.
Basic idea discussed with guenther@.
-rw-r--r-- | usr.bin/mandoc/main.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/main.h | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 34d1ed88179..2bc490207e0 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.175 2016/07/15 18:49:53 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.176 2016/07/15 19:31:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -927,7 +927,7 @@ woptions(struct curparse *curp, char *arg) while (*arg) { o = arg; - switch (getsubopt(&arg, UNCONST(toks), &v)) { + switch (getsubopt(&arg, (char * const *)toks, &v)) { case 0: curp->wstop = 1; break; diff --git a/usr.bin/mandoc/main.h b/usr.bin/mandoc/main.h index ee2cbf1d34a..54fb32dbe64 100644 --- a/usr.bin/mandoc/main.h +++ b/usr.bin/mandoc/main.h @@ -1,4 +1,4 @@ -/* $OpenBSD: main.h,v 1.20 2016/07/08 22:27:58 schwarze Exp $ */ +/* $OpenBSD: main.h,v 1.21 2016/07/15 19:31:53 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -16,8 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) - struct roff_man; struct manoutput; |