0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-14 00:34:18 +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) serialized(value)
}; };
char buffer[size]; mutable_buffer mb const unique_buffer<mutable_buffer> buffer
{ {
buffer, size size
}; };
switch(type(value)) switch(type(value))
{ {
case json::ARRAY: case json::ARRAY:
{ {
response(client, json::array{stringify(mb, value)}, code); response(client, json::array{stringify(mutable_buffer{buffer}, value)}, code);
return; return;
} }
case json::OBJECT: case json::OBJECT:
{ {
response(client, json::object{stringify(mb, value)}, code); response(client, json::object{stringify(mutable_buffer{buffer}, value)}, code);
return; return;
} }
@ -419,10 +419,14 @@ try
serialized(members) serialized(members)
}; };
char buffer[size]; const unique_buffer<mutable_buffer> buffer
{
size
};
const json::object object const json::object object
{ {
stringify(mutable_buffer{buffer, buffer + size}, members) stringify(mutable_buffer{buffer}, members)
}; };
response(client, object, code); response(client, object, code);
@ -445,10 +449,14 @@ try
serialized(members) serialized(members)
}; };
char buffer[size]; const unique_buffer<mutable_buffer> buffer
{
size
};
const json::object object const json::object object
{ {
stringify(mutable_buffer{buffer, buffer + size}, members) stringify(mutable_buffer{buffer}, members)
}; };
response(client, object, code); response(client, object, code);