From ab37f2d65b01370ae975346110471f33b10bd178 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 6 Jan 2010 17:23:13 -0800 Subject: ext: unpack response arrays unconditionally It's too crazy to have to special case for frozen response constants. 3-element arrays are cheap under Ruby 1.9 anyways. --- ext/clogger_ext/clogger.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'ext') diff --git a/ext/clogger_ext/clogger.c b/ext/clogger_ext/clogger.c index 26d1ec6..f2d82d6 100644 --- a/ext/clogger_ext/clogger.c +++ b/ext/clogger_ext/clogger.c @@ -689,10 +689,9 @@ static VALUE ccall(struct clogger *c, VALUE env) c->headers = tmp[1]; c->body = tmp[2]; + rv = rb_ary_new4(3, tmp); if (c->need_resp && cHeaderHash != rb_obj_class(c->headers)) { c->headers = rb_funcall(cHeaderHash, new_id, 1, tmp[1]); - if (OBJ_FROZEN(rv)) - rv = rb_ary_dup(rv); rb_ary_store(rv, 1, c->headers); } } else { @@ -732,8 +731,7 @@ static VALUE clogger_call(VALUE self, VALUE env) } rv = ccall(c, env); - if (OBJ_FROZEN(rv)) - rv = rb_ary_dup(rv); + assert(!OBJ_FROZEN(rv) && "frozen response array"); rb_ary_store(rv, 2, self); return rv; -- cgit v1.2.3-24-ge0c7