diff options
author | Markus Armbruster <armbru@redhat.com> | 2018-08-23 18:40:08 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-08-24 20:26:37 +0200 |
commit | 53a0d616fecab09870411573afc58fd24ffb8648 (patch) | |
tree | 78368fb74f977d94098a3a06a25b2eaf375d657f /qobject/json-parser.c | |
parent | f7617d45d4652ae10d38bd0c917d7488d155cccb (diff) | |
download | qemu-53a0d616fecab09870411573afc58fd24ffb8648.zip qemu-53a0d616fecab09870411573afc58fd24ffb8648.tar.gz qemu-53a0d616fecab09870411573afc58fd24ffb8648.tar.bz2 |
json: Replace %I64d, %I64u by %PRId64, %PRIu64
Support for %I64d got added in commit 2c0d4b36e7f "json: fix PRId64 on
Win32". We had to hard-code I64d because we used the lexer's finite
state machine to check interpolations. No more, so clean this up.
Additional conversion specifications would be easy enough to implement
when needed.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180823164025.12553-42-armbru@redhat.com>
Diffstat (limited to 'qobject/json-parser.c')
-rw-r--r-- | qobject/json-parser.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/qobject/json-parser.c b/qobject/json-parser.c index e61cee9..27e873a 100644 --- a/qobject/json-parser.c +++ b/qobject/json-parser.c @@ -438,16 +438,18 @@ static QObject *parse_interpolation(JSONParserContext *ctxt, va_list *ap) return QOBJECT(qnum_from_int(va_arg(*ap, int))); } else if (!strcmp(token->str, "%ld")) { return QOBJECT(qnum_from_int(va_arg(*ap, long))); - } else if (!strcmp(token->str, "%lld") || - !strcmp(token->str, "%I64d")) { + } else if (!strcmp(token->str, "%lld")) { return QOBJECT(qnum_from_int(va_arg(*ap, long long))); + } else if (!strcmp(token->str, "%" PRId64)) { + return QOBJECT(qnum_from_int(va_arg(*ap, int64_t))); } else if (!strcmp(token->str, "%u")) { return QOBJECT(qnum_from_uint(va_arg(*ap, unsigned int))); } else if (!strcmp(token->str, "%lu")) { return QOBJECT(qnum_from_uint(va_arg(*ap, unsigned long))); - } else if (!strcmp(token->str, "%llu") || - !strcmp(token->str, "%I64u")) { + } else if (!strcmp(token->str, "%llu")) { return QOBJECT(qnum_from_uint(va_arg(*ap, unsigned long long))); + } else if (!strcmp(token->str, "%" PRIu64)) { + return QOBJECT(qnum_from_uint(va_arg(*ap, uint64_t))); } else if (!strcmp(token->str, "%s")) { return QOBJECT(qstring_from_str(va_arg(*ap, const char *))); } else if (!strcmp(token->str, "%f")) { |