Rename the existing QLIT_QNUM macro to indicate it only supports
signed int values.  We're going to add support to other types of
QNums later.

Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
---
This is a new patch added in v3 of this series.

In v2, the existing QLIT_QNUM() macro was being kept, now it is
replaced by QLIT_QNUM_INT().
---
 include/qapi/qmp/qlit.h |  2 +-
 tests/check-qjson.c     | 30 +++++++++++++++---------------
 tests/check-qlit.c      | 10 +++++-----
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/qlit.h
index c0676d5daf..2fc2db282e 100644
--- a/include/qapi/qmp/qlit.h
+++ b/include/qapi/qmp/qlit.h
@@ -39,7 +39,7 @@ struct QLitDictEntry {
     { .type = QTYPE_QNULL }
 #define QLIT_QBOOL(val) \
     { .type = QTYPE_QBOOL, .value.qbool = (val) }
-#define QLIT_QNUM(val) \
+#define QLIT_QNUM_INT(val) \
     { .type = QTYPE_QNUM, .value.qnum = (val) }
 #define QLIT_QSTR(val) \
     { .type = QTYPE_QSTRING, .value.qstr = (val) }
diff --git a/tests/check-qjson.c b/tests/check-qjson.c
index 07a773e653..bc5b7ebdf3 100644
--- a/tests/check-qjson.c
+++ b/tests/check-qjson.c
@@ -1062,7 +1062,7 @@ static void simple_dict(void)
         {
             .encoded = "{\"foo\": 42, \"bar\": \"hello world\"}",
             .decoded = QLIT_QDICT(((QLitDictEntry[]){
-                        { "foo", QLIT_QNUM(42) },
+                        { "foo", QLIT_QNUM_INT(42) },
                         { "bar", QLIT_QSTR("hello world") },
                         { }
                     })),
@@ -1074,7 +1074,7 @@ static void simple_dict(void)
         }, {
             .encoded = "{\"foo\": 43}",
             .decoded = QLIT_QDICT(((QLitDictEntry[]){
-                        { "foo", QLIT_QNUM(43) },
+                        { "foo", QLIT_QNUM_INT(43) },
                         { }
                     })),
         },
@@ -1160,15 +1160,15 @@ static void simple_list(void)
         {
             .encoded = "[43,42]",
             .decoded = QLIT_QLIST(((QLitObject[]){
-                        QLIT_QNUM(43),
-                        QLIT_QNUM(42),
+                        QLIT_QNUM_INT(43),
+                        QLIT_QNUM_INT(42),
                         { }
                     })),
         },
         {
             .encoded = "[43]",
             .decoded = QLIT_QLIST(((QLitObject[]){
-                        QLIT_QNUM(43),
+                        QLIT_QNUM_INT(43),
                         { }
                     })),
         },
@@ -1217,35 +1217,35 @@ static void simple_whitespace(void)
         {
             .encoded = " [ 43 , 42 ]",
             .decoded = QLIT_QLIST(((QLitObject[]){
-                        QLIT_QNUM(43),
-                        QLIT_QNUM(42),
+                        QLIT_QNUM_INT(43),
+                        QLIT_QNUM_INT(42),
                         { }
                     })),
         },
         {
             .encoded = "\t[ 43 , { 'h' : 'b' },\r\n\t[ ], 42 ]\n",
             .decoded = QLIT_QLIST(((QLitObject[]){
-                        QLIT_QNUM(43),
+                        QLIT_QNUM_INT(43),
                         QLIT_QDICT(((QLitDictEntry[]){
                                     { "h", QLIT_QSTR("b") },
                                     { }})),
                         QLIT_QLIST(((QLitObject[]){
                                     { }})),
-                        QLIT_QNUM(42),
+                        QLIT_QNUM_INT(42),
                         { }
                     })),
         },
         {
             .encoded = " [ 43 , { 'h' : 'b' , 'a' : 32 }, [ ], 42 ]",
             .decoded = QLIT_QLIST(((QLitObject[]){
-                        QLIT_QNUM(43),
+                        QLIT_QNUM_INT(43),
                         QLIT_QDICT(((QLitDictEntry[]){
                                     { "h", QLIT_QSTR("b") },
-                                    { "a", QLIT_QNUM(32) },
+                                    { "a", QLIT_QNUM_INT(32) },
                                     { }})),
                         QLIT_QLIST(((QLitObject[]){
                                     { }})),
-                        QLIT_QNUM(42),
+                        QLIT_QNUM_INT(42),
                         { }
                     })),
         },
@@ -1275,11 +1275,11 @@ static void simple_interpolation(void)
     QObject *embedded_obj;
     QObject *obj;
     QLitObject decoded = QLIT_QLIST(((QLitObject[]){
-            QLIT_QNUM(1),
+            QLIT_QNUM_INT(1),
             QLIT_QSTR("100%"),
             QLIT_QLIST(((QLitObject[]){
-                        QLIT_QNUM(32),
-                        QLIT_QNUM(42),
+                        QLIT_QNUM_INT(32),
+                        QLIT_QNUM_INT(42),
                         {}})),
             {}}));
 
diff --git a/tests/check-qlit.c b/tests/check-qlit.c
index 58ceaae5a3..24ac21395c 100644
--- a/tests/check-qlit.c
+++ b/tests/check-qlit.c
@@ -17,12 +17,12 @@
 #include "qapi/qmp/qstring.h"
 
 static QLitObject qlit = QLIT_QDICT(((QLitDictEntry[]) {
-    { "foo", QLIT_QNUM(42) },
+    { "foo", QLIT_QNUM_INT(42) },
     { "bar", QLIT_QSTR("hello world") },
     { "baz", QLIT_QNULL },
     { "bee", QLIT_QLIST(((QLitObject[]) {
-        QLIT_QNUM(43),
-        QLIT_QNUM(44),
+        QLIT_QNUM_INT(43),
+        QLIT_QNUM_INT(44),
         QLIT_QBOOL(true),
         { },
     }))},
@@ -30,7 +30,7 @@ static QLitObject qlit = QLIT_QDICT(((QLitDictEntry[]) {
 }));
 
 static QLitObject qlit_foo = QLIT_QDICT(((QLitDictEntry[]) {
-    { "foo", QLIT_QNUM(42) },
+    { "foo", QLIT_QNUM_INT(42) },
     { },
 }));
 
@@ -72,7 +72,7 @@ static void qlit_equal_large_qnum_test(void)
     /* 2^32 */
     QNum *too_large = qnum_from_uint(9223372036854775808ULL);
     QNum *dbl = qnum_from_double(9223372036854775808.0);
-    QLitObject qlit_large = QLIT_QNUM(9223372036854775807LL);
+    QLitObject qlit_large = QLIT_QNUM_INT(9223372036854775807LL);
 
     g_assert(qlit_equal_qobject(&qlit_large, QOBJECT(large)));
     g_assert(!qlit_equal_qobject(&qlit_large, QOBJECT(too_large)));
-- 
2.28.0


Reply via email to