From 0a0757945ec3b005a4880649c0ee16556ad67d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Blanchon?= Date: Tue, 8 Jul 2014 13:49:35 +0200 Subject: [PATCH] Reduced the size of JsonHashTableBase::printTo() by 12 bytes --- JsonGenerator/JsonHashTableBase.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/JsonGenerator/JsonHashTableBase.cpp b/JsonGenerator/JsonHashTableBase.cpp index e7d70300..fafd9359 100644 --- a/JsonGenerator/JsonHashTableBase.cpp +++ b/JsonGenerator/JsonHashTableBase.cpp @@ -9,18 +9,18 @@ size_t JsonHashTableBase::printTo(Print& p) const n += p.write('{'); KeyValuePair* current = items; - for (int i = 0; i < count; i++) - { - if (i > 0) - { - n += p.write(','); - } - + for (int i = count; i > 0; i--) + { n += current->key.printTo(p); n += p.write(':'); n += current->value.printTo(p); current++; + + if (i > 1) + { + n += p.write(','); + } } n += p.write('}');