From 1fdcae66e82ef1cc939ea1aae801eb9eb061f640 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Thu, 18 Jul 2024 18:49:55 -0700 Subject: [PATCH 1/2] Fix #301 --- src/GraphQLResponse.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GraphQLResponse.cpp b/src/GraphQLResponse.cpp index dacccef0..f062a28f 100644 --- a/src/GraphQLResponse.cpp +++ b/src/GraphQLResponse.cpp @@ -896,6 +896,7 @@ IdType Value::release() } Value::Value(Type type /* = Type::Null */) + : _data { NullData {} } { switch (type) { @@ -911,10 +912,6 @@ Value::Value(Type type /* = Type::Null */) _data = { StringData {} }; break; - case Type::Null: - _data = { NullData {} }; - break; - case Type::Boolean: _data = { BooleanType { false } }; break; @@ -938,6 +935,9 @@ Value::Value(Type type /* = Type::Null */) case Type::Scalar: _data = { ScalarData {} }; break; + + default: + break; } } From 25604bdbc5a8a4eae1ea6e790f25aedbdcef8135 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Fri, 19 Jul 2024 00:16:02 -0700 Subject: [PATCH 2/2] Do not construct a temporary TypeData --- src/GraphQLResponse.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/GraphQLResponse.cpp b/src/GraphQLResponse.cpp index f062a28f..4036d628 100644 --- a/src/GraphQLResponse.cpp +++ b/src/GraphQLResponse.cpp @@ -901,39 +901,39 @@ Value::Value(Type type /* = Type::Null */) switch (type) { case Type::Map: - _data = { MapData {} }; + _data = MapData {}; break; case Type::List: - _data = { ListType {} }; + _data = ListType {}; break; case Type::String: - _data = { StringData {} }; + _data = StringData {}; break; case Type::Boolean: - _data = { BooleanType { false } }; + _data = BooleanType { false }; break; case Type::Int: - _data = { IntType { 0 } }; + _data = IntType { 0 }; break; case Type::Float: - _data = { FloatType { 0.0 } }; + _data = FloatType { 0.0 }; break; case Type::EnumValue: - _data = { EnumData {} }; + _data = EnumData {}; break; case Type::ID: - _data = { IdType {} }; + _data = IdType {}; break; case Type::Scalar: - _data = { ScalarData {} }; + _data = ScalarData {}; break; default: