0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

ircd::json: Minor cleanup; simplify conditionals.

This commit is contained in:
Jason Volk 2020-06-23 00:55:16 -07:00
parent ea1c0dcae7
commit 57e70512d0

View file

@ -3401,24 +3401,16 @@ ircd::json::stringify(mutable_buffer &buf,
consume(buf, copy(buf, "true"_sv)); consume(buf, copy(buf, "true"_sv));
else else
consume(buf, copy(buf, "false"_sv)); consume(buf, copy(buf, "false"_sv));
break; break;
} }
case OBJECT: case OBJECT:
{ {
if(v.serial) if(v.serial)
{
stringify(buf, json::object{string_view{v}}); stringify(buf, json::object{string_view{v}});
break; else if(v.object)
}
if(v.object)
{
stringify(buf, v.object, v.object + v.len); stringify(buf, v.object, v.object + v.len);
break; else
}
consume(buf, copy(buf, empty_object)); consume(buf, copy(buf, empty_object));
break; break;
} }
@ -3426,17 +3418,10 @@ ircd::json::stringify(mutable_buffer &buf,
case ARRAY: case ARRAY:
{ {
if(v.serial) if(v.serial)
{
stringify(buf, json::array{string_view{v}}); stringify(buf, json::array{string_view{v}});
break; else if(v.array)
}
if(v.array)
{
stringify(buf, v.array, v.array + v.len); stringify(buf, v.array, v.array + v.len);
break; else
}
consume(buf, copy(buf, empty_array)); consume(buf, copy(buf, empty_array));
break; break;
} }
@ -3450,7 +3435,6 @@ ircd::json::stringify(mutable_buffer &buf,
consume(buf, copy(buf, lex_cast(v.floating))); consume(buf, copy(buf, lex_cast(v.floating)));
else else
consume(buf, copy(buf, lex_cast(v.integer))); consume(buf, copy(buf, lex_cast(v.integer)));
break; break;
} }
} }