Re: [Qemu-devel] [PATCH v2 1/4] qjson: replace QString in JSONLexer with GString

2015-11-25 Thread Paolo Bonzini
On 25/11/2015 13:48, Markus Armbruster wrote: > Where does the 3 come from? My hat. :) I don't know---it was in the old patches, and I just brought it on. Oh, found it. GString adds 1 to the size (for the \0); allocating 4 bytes probably seemed like a good idea at the time. However, it also

Re: [Qemu-devel] [PATCH v2 1/4] qjson: replace QString in JSONLexer with GString

2015-11-25 Thread Markus Armbruster
Paolo Bonzini writes: > JSONLexer only needs a simple resizable buffer. json-streamer.c > can allocate memory for each token instead of relying on reference > counting of QStrings. On its own, this doesn't really save anything, it merely decouples the lexer's buffer from the rest of the machine

[Qemu-devel] [PATCH v2 1/4] qjson: replace QString in JSONLexer with GString

2015-11-23 Thread Paolo Bonzini
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 --- include/qapi/qmp/json-lexer.h| 7 +++ include/qapi/qmp/json-streamer.h | 1 + qobject/json-lexer.c