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

Update v7_stringify() to return length and v7_parse_json() to accept a length #540

Open
swisspol opened this issue Dec 19, 2015 · 1 comment

Comments

@swisspol
Copy link

v7_stringify() should have a way to return the length so that calling strlen() is not needed and v7_parse_json() should accept an optional length parameter (set to ~0 if unused).

This would optimize dealing with non-NUL terminated strings and reduce the number of string copies needed when interfacing v7 with the outside world.

@swisspol
Copy link
Author

Actually, looking at the source, I'm wondering if there's not a bug today in v7_parse_json_file(): it calls exec_file() which reads the file and its size and then passes both to i_exec(), which in turn calls parse() which doesn't take a size parameter anymore. Does parse() assumes src is NUL-terminated? If so, this would not work when used from v7_parse_json_file().

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