about summary refs log tree commit homepage
path: root/ext/kcar/kcar.rl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/kcar/kcar.rl')
-rw-r--r--ext/kcar/kcar.rl9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/kcar/kcar.rl b/ext/kcar/kcar.rl
index cbcfa97..79f65db 100644
--- a/ext/kcar/kcar.rl
+++ b/ext/kcar/kcar.rl
@@ -106,6 +106,11 @@ static VALUE str_dd_freeze(VALUE str)
   return str;
 }
 
+static VALUE str_new_dd_freeze(const char *ptr, long len)
+{
+  return str_dd_freeze(rb_str_new(ptr, len));
+}
+
 static VALUE stripped_str_new(const char *str, long len)
 {
   long end;
@@ -161,7 +166,7 @@ status_phrase(struct http_parser *hp, VALUE hdr, const char *ptr, size_t len)
 {
   long nr;
 
-  hp->status = str_dd_freeze(rb_str_new(ptr, len));
+  hp->status = str_new_dd_freeze(ptr, len);
 
   /* RSTRING_PTR is null terminated, ptr is not */
   nr = strtol(RSTRING_PTR(hp->status), NULL, 10);
@@ -238,7 +243,7 @@ static void write_value(VALUE hdr, struct http_parser *hp,
   vlen = LEN(mark, p);
   VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE);
   VALIDATE_MAX_LENGTH(flen, FIELD_NAME);
-  f = str_dd_freeze(rb_str_new(fptr, (long)flen));
+  f = str_new_dd_freeze(fptr, (long)flen);
   v = stripped_str_new(vptr, (long)vlen);
 
   /* needs more tests for error-checking here */