From 11810564cc4b6b8bfdc679f5a6384f4af6debe40 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 28 Jan 2015 18:54:15 +0000 Subject: http: standalone require + reduction in binary size This allows requiring just the C extension part of "unicorn_http", without requiring the rest of unicorn, allowing other HTTP servers using the same parser to be slimmer. On my x86-64 Debian 7.0 system: text data bss dec hex filename 44026 1976 488 46490 b59a lib/unicorn_http.so 43930 1976 456 46362 b51a lib/unicorn_http.so --- ext/unicorn_http/httpdate.c | 2 +- ext/unicorn_http/unicorn_http.rl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/unicorn_http/httpdate.c b/ext/unicorn_http/httpdate.c index bf54fdd..0a1045f 100644 --- a/ext/unicorn_http/httpdate.c +++ b/ext/unicorn_http/httpdate.c @@ -66,7 +66,7 @@ static VALUE httpdate(VALUE self) void init_unicorn_httpdate(void) { - VALUE mod = rb_const_get(rb_cObject, rb_intern("Unicorn")); + VALUE mod = rb_define_module("Unicorn"); mod = rb_define_module_under(mod, "HttpResponse"); buf = rb_str_new(0, buf_capa - 1); diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl index de83652..932d259 100644 --- a/ext/unicorn_http/unicorn_http.rl +++ b/ext/unicorn_http/unicorn_http.rl @@ -926,7 +926,7 @@ void Init_unicorn_http(void) { VALUE mUnicorn, cHttpParser; - mUnicorn = rb_const_get(rb_cObject, rb_intern("Unicorn")); + mUnicorn = rb_define_module("Unicorn"); cHttpParser = rb_define_class_under(mUnicorn, "HttpParser", rb_cObject); eHttpParserError = rb_define_class_under(mUnicorn, "HttpParserError", rb_eIOError); -- cgit v1.2.3-24-ge0c7