mirror of https://github.com/qt/qtgrpc.git
Reuse the serializedList variable in serializeListType
We may reuse the variable instead of instantiating the empty QByteArray. Pick-to: 6.8 6.9 Task-number: QTBUG-128812 Change-Id: I4c0b92926af6904f5003f3511f6dcf0e89c1e42f Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
This commit is contained in:
parent
dcaf650f2f
commit
d575f3e07b
|
@ -226,10 +226,10 @@ template <typename V, if_length_delimited<V> = true>
|
||||||
template <typename V, if_not_length_delimited<V> = true>
|
template <typename V, if_not_length_delimited<V> = true>
|
||||||
[[nodiscard]] QByteArray serializeListType(const QList<V> &listValue)
|
[[nodiscard]] QByteArray serializeListType(const QList<V> &listValue)
|
||||||
{
|
{
|
||||||
if (listValue.isEmpty())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
QByteArray serializedList;
|
QByteArray serializedList;
|
||||||
|
if (listValue.isEmpty())
|
||||||
|
return serializedList;
|
||||||
|
|
||||||
for (auto &value : listValue)
|
for (auto &value : listValue)
|
||||||
serializedList.append(serializeBasic<V>(value));
|
serializedList.append(serializeBasic<V>(value));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue