33static inline void token_init (
44 jstr_token_t * token , jstr_type_t type , uintptr_t value
55) {
6- #if JSTR_TOKEN_COMPRESSED
7- token -> type_and_value__ = value <<8 | type ;
8- #else
96 token -> type__ = type ;
107 token -> value__ = value ;
11- #endif
128}
139
1410// > 0: success, end pos
@@ -28,9 +24,6 @@ ssize_t jstr_parse(
2824 enum {
2925 TOP , OBJECT_VALUE = JSTR_OBJECT , ARRAY_ITEM = JSTR_ARRAY , OBJECT_KEY
3026 } cs = token_parent == token_cur ? TOP : jstr_type (token_parent );
31- #if JSTR_TOKEN_COMPRESSED
32- if (((uintptr_t )-1 >>8 ) <= token_count ) return JSTR_2BIG ;
33- #endif
3427parse_generic :
3528 if (token_end - token_cur < 2 ) {
3629 parser -> parse_pos = (char * )p - str ;
@@ -193,9 +186,6 @@ commit_token: {
193186 switch (cs ) {
194187 case TOP :
195188 if (c ) return JSTR_INVAL ;
196- #if JSTR_TOKEN_COMPRESSED
197- if ((uintptr_t )p > ((uintptr_t )-1 >>8 )) return JSTR_2BIG ;
198- #endif
199189 return (char * )p - str - 1 ;
200190 case OBJECT_KEY :
201191 if (c != ':' ) return JSTR_INVAL ;
@@ -214,9 +204,8 @@ commit_token: {
214204
215205pop_context : {
216206 jstr_token_t * token_grandparent = token_parent
217- - jstr__offset (token_parent );
218- token_init (
219- token_parent , jstr_type (token_parent ), token_cur - token_parent );
207+ - token_parent -> value__ ;
208+ token_parent -> value__ = token_cur - token_parent ;
220209 cs = token_parent == token_grandparent
221210 ? TOP : jstr_type (token_grandparent );
222211 token_parent = token_grandparent ;
0 commit comments