Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
jsmn: opportunistic speed up of children loop
Baptiste Daroussin committed 1 year ago
commit f8c939059bfc8b7134dc234353ac0dd565d4a023
parent 3ae5eea
1 file changed +4 -0
modified libpkg/json.c
@@ -33,6 +33,10 @@ jsmntok_nextchild(jsmntok_t *tok, int tokcount, int parent, int me)
	for (int i = me + 1; i < tokcount; i++) {
		if ((tok + i)->parent == parent)
			return (i);
+
		/* skip all the objet child, useful if this is an array
+
		 * or an object
+
		 */
+
		i += (tok + i)->size;
	}
	return (-1);
}