nghttpx: Use gc arena save/restore when creating headers hash
This commit is contained in:
parent
587f37a597
commit
226a09b04a
|
@ -107,6 +107,8 @@ mrb_value create_headers_hash(mrb_state *mrb, const Headers &headers) {
|
||||||
if (hd.name.empty() || hd.name[0] == ':') {
|
if (hd.name.empty() || hd.name[0] == ':') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
auto ai = mrb_gc_arena_save(mrb);
|
||||||
|
|
||||||
auto key = mrb_str_new(mrb, hd.name.c_str(), hd.name.size());
|
auto key = mrb_str_new(mrb, hd.name.c_str(), hd.name.size());
|
||||||
auto ary = mrb_hash_get(mrb, hash, key);
|
auto ary = mrb_hash_get(mrb, hash, key);
|
||||||
if (mrb_nil_p(ary)) {
|
if (mrb_nil_p(ary)) {
|
||||||
|
@ -114,6 +116,8 @@ mrb_value create_headers_hash(mrb_state *mrb, const Headers &headers) {
|
||||||
mrb_hash_set(mrb, hash, key, ary);
|
mrb_hash_set(mrb, hash, key, ary);
|
||||||
}
|
}
|
||||||
mrb_ary_push(mrb, ary, mrb_str_new(mrb, hd.value.c_str(), hd.value.size()));
|
mrb_ary_push(mrb, ary, mrb_str_new(mrb, hd.value.c_str(), hd.value.size()));
|
||||||
|
|
||||||
|
mrb_gc_arena_restore(mrb, ai);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
|
|
Loading…
Reference in New Issue