diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-07-15 19:33:01 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-07-15 19:33:01 +0000 |
commit | 7be71b94a8ef4f8dd907990987d02db901b5efda (patch) | |
tree | 41e73ed733ddb6a56f9e053476812509a17ac148 | |
parent | d3d6f7026424951a4de6ff2d186755d537a6f030 (diff) | |
download | mandoc-7be71b94a8ef4f8dd907990987d02db901b5efda.tar.gz mandoc-7be71b94a8ef4f8dd907990987d02db901b5efda.tar.zst mandoc-7be71b94a8ef4f8dd907990987d02db901b5efda.zip |
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-- | main.c | 4 | ||||
-rw-r--r-- | main.h | 4 |
2 files changed, 3 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.271 2016/07/15 18:50:20 schwarze Exp $ */ +/* $Id: main.c,v 1.272 2016/07/15 19:33:01 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -980,7 +980,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; @@ -1,4 +1,4 @@ -/* $Id: main.h,v 1.25 2016/07/08 22:29:05 schwarze Exp $ */ +/* $Id: main.h,v 1.26 2016/07/15 19:33:01 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; |