about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--ext/unicorn_http/ext_help.h2
-rw-r--r--ext/unicorn_http/unicorn_http.rl1
2 files changed, 2 insertions, 1 deletions
diff --git a/ext/unicorn_http/ext_help.h b/ext/unicorn_http/ext_help.h
index d1b71d6..bd29cc7 100644
--- a/ext/unicorn_http/ext_help.h
+++ b/ext/unicorn_http/ext_help.h
@@ -28,7 +28,7 @@ static void rb_18_str_set_len(VALUE str, long len)
 #if defined(OBJ_FROZEN)
 #  define assert_frozen(f) assert(OBJ_FROZEN(f) && "unfrozen object")
 #else
-#  define assert_frozen(f) assert(!NIL_P(f))
+#  define assert_frozen(f) do {} while (0)
 #endif
 
 #if !defined(OFFT2NUM)
diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl
index 39dbd45..5cacb37 100644
--- a/ext/unicorn_http/unicorn_http.rl
+++ b/ext/unicorn_http/unicorn_http.rl
@@ -192,6 +192,7 @@ static void write_value(VALUE req, struct http_parser *hp,
     HP_FL_SET(hp, HASTRAILER);
     hp_invalid_if_trailer(hp);
   } else {
+    assert(TYPE(f) == T_STRING && "memoized object is not a string");
     assert_frozen(f);
   }