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-07-31 23:46:21 -0700
committerEric Wong <normalperson@yhbt.net>2009-08-09 01:18:49 -0700
commitfb7f6739c5bc041a28ae45fea80f840459523f8e (patch)
treef4afd31a6d96a36d8865ccf180aaf51fb54229b8 /ext/unicorn_http/ext_help.h
parente710d55dd171ab560d9cc1b1684f0e415b153c76 (diff)
downloadunicorn-fb7f6739c5bc041a28ae45fea80f840459523f8e.tar.gz
Use Data_Make_Struct instead of Data_Wrap_Struct to avoid extra
steps/code in object allocation.  The GC will also free()
implicitly if no free callback is passed to Data_Make_Struct,
and we don't need an extra method here...

Since we're more comfortable with object management nowadays,
just make the data_get() fail with an assertion failure if it
somehow (very unlikely) ends up getting a NULL parser object.
Unicorn itself has no way of recovering other than throwing
errors to clients anyways and we have bigger problems if there's
a GC bug causing this.

Then, finally, reduce the size of our http_parser struct even
more (we'll add an int back later) since we know it's safe to
do so...
Diffstat (limited to 'ext/unicorn_http/ext_help.h')
-rw-r--r--ext/unicorn_http/ext_help.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/unicorn_http/ext_help.h b/ext/unicorn_http/ext_help.h
index 17f7b01..8220600 100644
--- a/ext/unicorn_http/ext_help.h
+++ b/ext/unicorn_http/ext_help.h
@@ -3,10 +3,11 @@
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
-#ifdef DEBUG
-#define TRACE()  fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
-#else
-#define TRACE()
+#ifndef RSTRING_PTR
+#define RSTRING_PTR(s) (RSTRING(s)->ptr)
+#endif
+#ifndef RSTRING_LEN
+#define RSTRING_LEN(s) (RSTRING(s)->len)
 #endif
 
 #endif