From ace625cfb1aa1b3c2f06890fb1f97900059bf226 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 18 Feb 2010 18:53:03 -0800 Subject: http: const correctness fixes Not fun, but maybe this can help us spot _real_ problems more easily in the future. --- ext/unicorn_http/c_util.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ext/unicorn_http/c_util.h') diff --git a/ext/unicorn_http/c_util.h b/ext/unicorn_http/c_util.h index 9e674fa..8542b3d 100644 --- a/ext/unicorn_http/c_util.h +++ b/ext/unicorn_http/c_util.h @@ -29,6 +29,19 @@ # error off_t size unknown for this platform! #endif /* SIZEOF_OFF_T check */ +/* + * ragel enforces fpc as a const, and merely casting can make picky + * compilers unhappy, so we have this little helper do our dirty work + */ +static inline void *deconst(const void *in) +{ + union { const void *in; void *out; } tmp; + + tmp.in = in; + + return tmp.out; +} + /* * capitalizes all lower-case ASCII characters and converts dashes * to underscores for HTTP headers. Locale-agnostic. -- cgit v1.2.3-24-ge0c7