0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd: Use dynamic allocations for these resource response buffers.

This commit is contained in:
Jason Volk 2017-10-28 12:31:26 -07:00
parent 45b853c912
commit ac756a8856

View file

@ -376,22 +376,22 @@ try
serialized(value)
};
char buffer[size]; mutable_buffer mb
const unique_buffer<mutable_buffer> buffer
{
buffer, size
size
};
switch(type(value))
{
case json::ARRAY:
{
response(client, json::array{stringify(mb, value)}, code);
response(client, json::array{stringify(mutable_buffer{buffer}, value)}, code);
return;
}
case json::OBJECT:
{
response(client, json::object{stringify(mb, value)}, code);
response(client, json::object{stringify(mutable_buffer{buffer}, value)}, code);
return;
}
@ -419,10 +419,14 @@ try
serialized(members)
};
char buffer[size];
const unique_buffer<mutable_buffer> buffer
{
size
};
const json::object object
{
stringify(mutable_buffer{buffer, buffer + size}, members)
stringify(mutable_buffer{buffer}, members)
};
response(client, object, code);
@ -445,10 +449,14 @@ try
serialized(members)
};
char buffer[size];
const unique_buffer<mutable_buffer> buffer
{
size
};
const json::object object
{
stringify(mutable_buffer{buffer, buffer + size}, members)
stringify(mutable_buffer{buffer}, members)
};
response(client, object, code);