about summary refs log tree commit homepage
path: root/ext/unicorn_http/c_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/unicorn_http/c_util.h')
-rw-r--r--ext/unicorn_http/c_util.h13
1 files changed, 13 insertions, 0 deletions
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
@@ -30,6 +30,19 @@
 #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.
  */