about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--ext/unicorn_http/c_util.h15
-rw-r--r--ext/unicorn_http/common_field_optimization.h1
-rw-r--r--ext/unicorn_http/ext_help.h15
3 files changed, 16 insertions, 15 deletions
diff --git a/ext/unicorn_http/c_util.h b/ext/unicorn_http/c_util.h
index 30e7ae2..78ad168 100644
--- a/ext/unicorn_http/c_util.h
+++ b/ext/unicorn_http/c_util.h
@@ -6,6 +6,21 @@
 #ifndef UH_util_h
 #define UH_util_h
 
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+
+#ifndef SIZEOF_OFF_T
+#  define SIZEOF_OFF_T 4
+#  warning SIZEOF_OFF_T not defined, guessing 4.  Did you run extconf.rb?
+#endif
+
+#if SIZEOF_OFF_T == 4
+#  define UH_OFF_T_MAX 0x7fffffff
+#elif SIZEOF_OFF_T == 8
+#  define UH_OFF_T_MAX 0x7fffffffffffffff
+#else
+#  error off_t size unknown for this platform!
+#endif
+
 /*
  * capitalizes all lower-case ASCII characters and converts dashes
  * to underscores for HTTP headers.  Locale-agnostic.
diff --git a/ext/unicorn_http/common_field_optimization.h b/ext/unicorn_http/common_field_optimization.h
index 97640c6..dd090a6 100644
--- a/ext/unicorn_http/common_field_optimization.h
+++ b/ext/unicorn_http/common_field_optimization.h
@@ -1,6 +1,7 @@
 #ifndef common_field_optimization
 #define common_field_optimization
 #include "ruby.h"
+#include "c_util.h"
 
 struct common_field {
   const signed long len;
diff --git a/ext/unicorn_http/ext_help.h b/ext/unicorn_http/ext_help.h
index 8ccb2b9..fec4f41 100644
--- a/ext/unicorn_http/ext_help.h
+++ b/ext/unicorn_http/ext_help.h
@@ -1,8 +1,6 @@
 #ifndef ext_help_h
 #define ext_help_h
 
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-
 #ifndef RSTRING_PTR
 #define RSTRING_PTR(s) (RSTRING(s)->ptr)
 #endif
@@ -10,19 +8,6 @@
 #define RSTRING_LEN(s) (RSTRING(s)->len)
 #endif
 
-#ifndef SIZEOF_OFF_T
-#  define SIZEOF_OFF_T 4
-#  warning SIZEOF_OFF_T not defined, guessing 4.  Did you run extconf.rb?
-#endif
-
-#if SIZEOF_OFF_T == 4
-#  define UH_OFF_T_MAX 0x7fffffff
-#elif SIZEOF_OFF_T == 8
-#  define UH_OFF_T_MAX 0x7fffffffffffffff
-#else
-#  error off_t size unknown for this platform!
-#endif
-
 #ifndef HAVE_RB_STR_SET_LEN
 /* this is taken from Ruby 1.8.7, 1.8.6 may not have it */
 static void rb_18_str_set_len(VALUE str, long len)