Diff for /libelwix/src/json.c between versions 1.6 and 1.7

version 1.6, 2018/04/19 16:13:48 version 1.7, 2018/06/26 14:39:13
Line 1025  json_add_pair(char * __restrict jstr, int jlen, int ws Line 1025  json_add_pair(char * __restrict jstr, int jlen, int ws
 }  }
   
 /*  /*
    * json_add_pair2() - Adds key/value pair with formated args
    *
    * @jstr = JSON string
    * @jlen = JSON string length
    * @wspace = whitespace include
    * @key = Key string
    * @fmt = Format string for values
    * return: -1 error or !=-1 actual JSON string length
    */
   int
   json_add_pair2(char * __restrict jstr, int jlen, int wspace, const char *key, const char *fmt, ...)
   {
           int len = -1;
           size_t eos;
           va_list lst;
           char szStr[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 };
   
           if (!jstr || !key || !fmt)
                   return -1;
           else
                   eos = strlen(jstr);
   
           if (json_add_string(jstr, jlen, 0, key) == -1) {
                   jstr[eos] = 0;
                   return -1;
           }
           if (json_add_colon(jstr, jlen, wspace) == -1) {
                   jstr[eos] = 0;
                   return -1;
           }
           va_start(lst, fmt);
           vsnprintf(szStr, sizeof szStr, fmt, lst);
           va_end(lst);
           if ((len = json_add_string(jstr, jlen, 0, szStr)) == -1) {
                   jstr[eos] = 0;
                   return -1;
           }
   
           return len;
   }
   
   /*
  * json_add_array() - Adds array   * json_add_array() - Adds array
  *   *
  * @jstr = JSON string   * @jstr = JSON string

Removed from v.1.6  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>