All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/4] qjson: replace QString in JSONLexer with GString
Date: Fri, 20 Nov 2015 21:16:53 +0100	[thread overview]
Message-ID: <564F7FB4.8000301@redhat.com> (raw)
In-Reply-To: <564F651A.6090107@redhat.com>



On 20/11/2015 19:23, Eric Blake wrote:
> On 11/20/2015 02:04 AM, Paolo Bonzini wrote:
>> 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>
>> ---
>>  include/qapi/qmp/json-lexer.h    |  7 +++----
>>  include/qapi/qmp/json-streamer.h |  1 +
>>  qobject/json-lexer.c             | 22 ++++++++--------------
>>  qobject/json-streamer.c          | 10 +++++-----
>>  4 files changed, 17 insertions(+), 23 deletions(-)
>>
> 
>> --- 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"
>>  
> 
> Spurious hunk? If not, should mention in the commit message why this is
> needed.

Does "because otherwise it doesn't compile" count? :)

It was relying on json-lexer.h indirectly including stdint.h.  I don't
think it ought to be mentioned in the commit message.

Paolo

>> +++ b/qobject/json-streamer.c
>> @@ -12,6 +12,7 @@
>>   */
>>  
>>  #include "qapi/qmp/qlist.h"
>> +#include "qapi/qmp/qstring.h"
>>  #include "qapi/qmp/qint.h"
>>  #include "qapi/qmp/qdict.h"
>>  #include "qemu-common.h"
>> @@ -21,13 +22,13 @@
>>  #define MAX_TOKEN_SIZE (64ULL << 20)
>>  #define MAX_NESTING (1ULL << 10)
>>  
>> -static void json_message_process_token(JSONLexer *lexer, QString *token, JSONTokenType type, int x, int y)
>> +static void json_message_process_token(JSONLexer *lexer, GString *input, JSONTokenType type, int x, int y)
> 
> Worth wrapping the long line while touching it?
> 
> Otherwise looks like a straightforward conversion.  If the commit
> message is fixed, you can add
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 

  reply	other threads:[~2015-11-20 20:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-20  9:04 [Qemu-devel] [PATCH 0/4] qjson: save a lot of memory Paolo Bonzini
2015-11-20  9:04 ` [Qemu-devel] [PATCH 1/4] qjson: replace QString in JSONLexer with GString Paolo Bonzini
2015-11-20 18:23   ` Eric Blake
2015-11-20 20:16     ` Paolo Bonzini [this message]
2015-11-20  9:04 ` [Qemu-devel] [PATCH 2/4] qjson: do not save/restore contexts Paolo Bonzini
2015-11-20 18:28   ` Eric Blake
2015-11-20 20:17     ` Paolo Bonzini
2015-11-20  9:04 ` [Qemu-devel] [PATCH 3/4] qjson: store tokens in a GQueue Paolo Bonzini
2015-11-20 18:40   ` Eric Blake
2015-11-20  9:04 ` [Qemu-devel] [PATCH 4/4] qjson: surprise, allocating 6 QObjects per token is expensive Paolo Bonzini
2015-11-20 18:48   ` Eric Blake
2015-11-20 20:19     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=564F7FB4.8000301@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.