jsoninfo: only need to reset entry number for json output
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 1 Dec 2015 14:09:13 +0000 (15:09 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 2 Dec 2015 17:41:14 +0000 (18:41 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/jsoninfo/src/olsrd_jsoninfo.c

index 22416f5..1236228 100644 (file)
@@ -396,9 +396,6 @@ static void send_info(unsigned int send_what, int the_socket) {
   int contentLengthPlaceholderStart = 0;
   int headerLength = 0;
 
-  /* global variables for tracking when to put a comma in for JSON */
-  abuf_json_reset_entry_number_and_depth();
-
   abuf_init(&abuf, 2 * 4096);
 
   if (http_headers) {
@@ -408,6 +405,8 @@ static void send_info(unsigned int send_what, int the_socket) {
 
   // only add if normal format
   if (send_what & SIW_ALL) {
+    /* global variables for tracking when to put a comma in for JSON */
+    abuf_json_reset_entry_number_and_depth();
     abuf_json_mark_output(true, &abuf);
 
     abuf_json_int(&abuf, "systemTime", time(NULL));