From 52ee74fe55dcfddfd52ea88886de5a99d2a0667e Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 26 Jan 2018 19:02:56 -0800 Subject: [PATCH] ircd::json: Place missing break; cleanup branches. --- ircd/json.cc | 54 +++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/ircd/json.cc b/ircd/json.cc index cc6122049..a454fd5fb 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -1218,39 +1218,45 @@ ircd::json::value::value(const value &other) else switch(type) { case OBJECT: - if(!serial && object) - { - const size_t count(this->len); - create_string(serialized(object, object + count), [this, &count] - (mutable_buffer buffer) - { - json::stringify(buffer, object, object + count); - }); - } + { + if(serial || !object) + break; + const size_t count(this->len); + create_string(serialized(object, object + count), [this, &count] + (mutable_buffer buffer) + { + json::stringify(buffer, object, object + count); + }); break; + } case ARRAY: - if(!serial && array) + { + if(serial || !array) + break; + + const size_t count(this->len); + create_string(serialized(array, array + count), [this, &count] + (mutable_buffer buffer) { - const size_t count(this->len); - create_string(serialized(array, array + count), [this, &count] - (mutable_buffer buffer) - { - json::stringify(buffer, array, array + count); - }); - } + json::stringify(buffer, array, array + count); + }); break; + } case STRING: - if(!serial && alloc && string) + { + if(serial || !alloc || !string) + break; + + create_string(serialized(*this), [this] + (mutable_buffer buffer) { - create_string(serialized(*this), [this] - (mutable_buffer buffer) - { - json::stringify(buffer, *this); - }); - } + json::stringify(buffer, *this); + }); + break; + } case LITERAL: case NUMBER: