[Git][NTPsec/ntpsec][master] Update to latest jsmn git repo

Matt Selsky (@selsky) gitlab at mg.gitlab.com
Wed Jan 4 22:20:40 UTC 2023



Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
4af61e3d by Matt Selsky at 2023-01-04T17:17:50-05:00
Update to latest jsmn git repo

- Make jsmntype_t values bit flags
- Fix position of a comment in string parsing

Fixes NTPsec/ntpsec#751

- - - - -


3 changed files:

- libjsmn/External-Version.txt
- libjsmn/README.md
- libjsmn/jsmn.h


Changes:

=====================================
libjsmn/External-Version.txt
=====================================
@@ -1,4 +1,4 @@
 Upstream Source: https://github.com/zserge/jsmn
 Description: Jsmn is a world fastest JSON parser/tokenizer.
-Synchronised on: 2020-05-24
-Synchronised at: 053d3cd29200edb1bfd181d917d140c16c1f8834
+Synchronised on: 2023-01-04
+Synchronised at: 25647e692c7906b96ffd2b05ca54c097948e879c


=====================================
libjsmn/README.md
=====================================
@@ -89,7 +89,7 @@ jsmn_parser p;
 jsmntok_t t[128]; /* We expect no more than 128 JSON tokens */
 
 jsmn_init(&p);
-r = jsmn_parse(&p, s, strlen(s), t, 128);
+r = jsmn_parse(&p, s, strlen(s), t, 128); // "s" is the char array holding the json content
 ```
 
 Since jsmn is a single-header, header-only library, for more complex use cases
@@ -113,10 +113,10 @@ Token types are described by `jsmntype_t`:
 
 	typedef enum {
 		JSMN_UNDEFINED = 0,
-		JSMN_OBJECT = 1,
-		JSMN_ARRAY = 2,
-		JSMN_STRING = 3,
-		JSMN_PRIMITIVE = 4
+		JSMN_OBJECT = 1 << 0,
+		JSMN_ARRAY = 1 << 1,
+		JSMN_STRING = 1 << 2,
+		JSMN_PRIMITIVE = 1 << 3
 	} jsmntype_t;
 
 **Note:** Unlike JSON data types, primitive tokens are not divided into


=====================================
libjsmn/jsmn.h
=====================================
@@ -26,10 +26,10 @@ extern "C" {
  */
 typedef enum {
   JSMN_UNDEFINED = 0,
-  JSMN_OBJECT = 1,
-  JSMN_ARRAY = 2,
-  JSMN_STRING = 3,
-  JSMN_PRIMITIVE = 4
+  JSMN_OBJECT = 1 << 0,
+  JSMN_ARRAY = 1 << 1,
+  JSMN_STRING = 1 << 2,
+  JSMN_PRIMITIVE = 1 << 3
 } jsmntype_t;
 
 enum jsmnerr {
@@ -177,10 +177,10 @@ static int jsmn_parse_string(jsmn_parser *parser, const char *js,
   jsmntok_t *token;
 
   int start = parser->pos;
-
-  parser->pos++;
-
+  
   /* Skip starting quote */
+  parser->pos++;
+  
   for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
     char c = js[parser->pos];
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/4af61e3d985ba0be56bea2e87e5355f39db8b882

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/4af61e3d985ba0be56bea2e87e5355f39db8b882
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20230104/fa808131/attachment-0001.htm>


More information about the vc mailing list