about summary refs log tree commit homepage
path: root/ext/unicorn_http/ext_help.h
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-09-14 17:08:18 -0700
committerEric Wong <normalperson@yhbt.net>2009-09-14 23:17:55 -0700
commitdbca9cc80d682305440ac4a94c5c72c8cf076021 (patch)
treeb1f35122fbea821f8b3e7369d78f0418abbc61f4 /ext/unicorn_http/ext_help.h
parent524aaed06a00780d698ad2becd66bd6d7fa5723d (diff)
downloadunicorn-dbca9cc80d682305440ac4a94c5c72c8cf076021.tar.gz
Rubinius does not support frozen objects, maybe other Rubies
lack support for it as well.
Diffstat (limited to 'ext/unicorn_http/ext_help.h')
-rw-r--r--ext/unicorn_http/ext_help.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/unicorn_http/ext_help.h b/ext/unicorn_http/ext_help.h
index 5f7c296..d8bfc7d 100644
--- a/ext/unicorn_http/ext_help.h
+++ b/ext/unicorn_http/ext_help.h
@@ -18,6 +18,13 @@ static void rb_18_str_set_len(VALUE str, long len)
 #  define rb_str_set_len(str,len) rb_18_str_set_len(str,len)
 #endif
 
+/* not all Ruby implementations support frozen objects (Rubinius does not) */
+#if defined(OBJ_FROZEN)
+#  define assert_frozen(f) assert(OBJ_FROZEN(f) && "unfrozen object")
+#else
+#  define assert_frozen(f) assert(!NIL_P(f))
+#endif
+
 static inline int str_cstr_eq(VALUE val, const char *ptr, size_t len)
 {
   return (RSTRING_LEN(val) == len && !memcmp(ptr, RSTRING_PTR(val), len));