summaryrefslogtreecommitdiffstats
path: root/include/qapi
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-11-25 22:23:29 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-11-26 09:31:22 +0100
commitd2ca7c0b0d876cf0e219ae7a92252626b0913a28 (patch)
treeb3b33462ad5376ef9cc4a4b90415365fddbe0c73 /include/qapi
parent6b9606f68ec589def27bd2a9cea97ec63cffd581 (diff)
downloadhqemu-d2ca7c0b0d876cf0e219ae7a92252626b0913a28.zip
hqemu-d2ca7c0b0d876cf0e219ae7a92252626b0913a28.tar.gz
qjson: replace QString in JSONLexer with GString
JSONLexer only needs a simple resizable buffer. json-streamer.c can allocate memory for each token instead of relying on reference counting of QStrings. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1448300659-23559-2-git-send-email-pbonzini@redhat.com> [Straightforwardly rebased on my patches, checkpatch made happy] Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include/qapi')
-rw-r--r--include/qapi/qmp/json-lexer.h8
-rw-r--r--include/qapi/qmp/json-streamer.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/include/qapi/qmp/json-lexer.h b/include/qapi/qmp/json-lexer.h
index f3e8dc7..cb456d5 100644
--- a/include/qapi/qmp/json-lexer.h
+++ b/include/qapi/qmp/json-lexer.h
@@ -14,8 +14,7 @@
#ifndef QEMU_JSON_LEXER_H
#define QEMU_JSON_LEXER_H
-#include "qapi/qmp/qstring.h"
-#include "qapi/qmp/qlist.h"
+#include "glib-compat.h"
typedef enum json_token_type {
JSON_MIN = 100,
@@ -36,13 +35,14 @@ typedef enum json_token_type {
typedef struct JSONLexer JSONLexer;
-typedef void (JSONLexerEmitter)(JSONLexer *, QString *, JSONTokenType, int x, int y);
+typedef void (JSONLexerEmitter)(JSONLexer *, GString *,
+ JSONTokenType, int x, int y);
struct JSONLexer
{
JSONLexerEmitter *emit;
int state;
- QString *token;
+ GString *token;
int x, y;
};
diff --git a/include/qapi/qmp/json-streamer.h b/include/qapi/qmp/json-streamer.h
index 823f7d7..e901144 100644
--- a/include/qapi/qmp/json-streamer.h
+++ b/include/qapi/qmp/json-streamer.h
@@ -14,6 +14,7 @@
#ifndef QEMU_JSON_STREAMER_H
#define QEMU_JSON_STREAMER_H
+#include <stdint.h>
#include "qapi/qmp/qlist.h"
#include "qapi/qmp/json-lexer.h"
OpenPOWER on IntegriCloud