]> granicus.if.org Git - json-c/commitdiff
Move a variable declaration to the start of the block to work better with older compi...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Sun, 9 Jul 2017 23:08:29 +0000 (16:08 -0700)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Sun, 9 Jul 2017 23:09:09 +0000 (16:09 -0700)
json_object.c

index bd65daf652dd57aa1a848b268a720bf87ce2fdd9..ddc96bc1902581204e5cb143909b1c67b24eb33f 100644 (file)
@@ -143,11 +143,11 @@ static int json_escape_str(struct printbuf *pb, const char *str, int len, int fl
                default:
                        if(c < ' ')
                        {
+                               char sbuf[7];
                                if(pos - start_offset > 0)
                                        printbuf_memappend(pb,
                                                           str + start_offset,
                                                           pos - start_offset);
-                               char sbuf[7];
                                snprintf(sbuf, sizeof(sbuf),
                                         "\\u00%c%c",
                                         json_hex_chars[c >> 4],