Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsmntok_t with smaller size type #239

Open
jcecconi opened this issue Aug 9, 2024 · 0 comments
Open

jsmntok_t with smaller size type #239

jcecconi opened this issue Aug 9, 2024 · 0 comments

Comments

@jcecconi
Copy link

jcecconi commented Aug 9, 2024

Sometimes, in embedded devices like the ESP32, using the 'int' type implies using 32 bits, which is often unnecessary. If you then need to use an array of this struct, it could consume a lot of stack memory. This is why I propose using uint16_t in the following way:

#Iifdef USE_JSMNTYPE_UINT16
typedef struct jsmntok {
jsmntype_t type;
uint16_t start;
uint16_t end;
uint16_t size;
#ifdef JSMN_PARENT_LINKS
uint16_t parent;
#endif
} jsmntok_t;
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant