Diff for /libelwix/src/json.c between versions 1.3 and 1.4

version 1.3, 2017/12/03 21:50:23 version 1.4, 2018/03/07 12:29:28
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004 - 2017Copyright 2004 - 2018
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 487  json_token2num(const char *jstr, jtok_t * __restrict t Line 487  json_token2num(const char *jstr, jtok_t * __restrict t
  *   *
  * @jstr = JSON string   * @jstr = JSON string
  * @key = Search key   * @key = Search key
    * @type = Search key for particular token type, if is J_UNDEF this mean any type
  * @toks = Parsed tokens   * @toks = Parsed tokens
  * @toksnum = Number of parsed tokens   * @toksnum = Number of parsed tokens
  * return: =NULL error or !=NULL data token found    * return: =NULL error or !=NULL data token found 
  */   */
 jtok_t *  jtok_t *
json_findbykey(const char *jstr, const char *key, jtok_t * __restrict toks, int toksnum)json_findbykey(const char *jstr, const char *key, jtype_t type, jtok_t * __restrict toks, int toksnum)
 {  {
         jtok_t *tok = NULL;          jtok_t *tok = NULL;
         register int i;          register int i;
Line 507  json_findbykey(const char *jstr, const char *key, jtok Line 508  json_findbykey(const char *jstr, const char *key, jtok
                 if (toks[i].tok_type == J_STRING &&                   if (toks[i].tok_type == J_STRING && 
                                 klen == toks[i].tok_end - toks[i].tok_start &&                                   klen == toks[i].tok_end - toks[i].tok_start && 
                                 !strncmp(jstr + toks[i].tok_start, key, klen)) {                                  !strncmp(jstr + toks[i].tok_start, key, klen)) {
                        tok = toks + i + 1;                        if (type != J_UNDEF) {
                        break;                                if (toks[i + 1].tok_type == type) {
                                         tok = toks + i + 1;
                                         break;
                                 }
                         } else {
                                 tok = toks + i + 1;
                                 break;
                         }
                 }                  }
         }          }
   

Removed from v.1.3  
changed lines
  Added in v.1.4


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