]> git.proxmox.com Git - qemu.git/commitdiff
json-lexer: Drop 'buf'
authorLuiz Capitulino <lcapitulino@redhat.com>
Mon, 17 May 2010 20:59:00 +0000 (17:59 -0300)
committerLuiz Capitulino <lcapitulino@redhat.com>
Fri, 11 Jun 2010 18:25:14 +0000 (15:25 -0300)
QString supports adding a single char, 'buf' is unneeded.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
json-lexer.c

index 5cc7e6c9a911ba65dbb5d821f0578710f7c2af7d..1d9b81fef4c015cbac985c8e3b50693e05810cdf 100644 (file)
@@ -284,8 +284,6 @@ void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func)
 
 static int json_lexer_feed_char(JSONLexer *lexer, char ch)
 {
-    char buf[2];
-
     lexer->x++;
     if (ch == '\n') {
         lexer->x = 0;
@@ -313,10 +311,7 @@ static int json_lexer_feed_char(JSONLexer *lexer, char ch)
         break;
     }
 
-    buf[0] = ch;
-    buf[1] = 0;
-
-    qstring_append(lexer->token, buf);
+    qstring_append_chr(lexer->token, ch);
 
     return 0;
 }