about summary refs log tree commit homepage
path: root/ext/unicorn_http/c_util.h
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-08-02 15:47:47 -0700
committerEric Wong <normalperson@yhbt.net>2009-08-09 01:28:40 -0700
commit58416c84acee42ef58e67762b1d158c95650a060 (patch)
treeb0a2dc763197db0d38ef366b4ac13bc446a903c9 /ext/unicorn_http/c_util.h
parentb512747b3579eac29a59eac7469bb3aa109f78b4 (diff)
downloadunicorn-58416c84acee42ef58e67762b1d158c95650a060.tar.gz
Diffstat (limited to 'ext/unicorn_http/c_util.h')
-rw-r--r--ext/unicorn_http/c_util.h15
1 files changed, 15 insertions, 0 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.