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

Check all results of zpl_alloc() when using JSON parser/writer #106

Merged
merged 7 commits into from
Jan 20, 2023

Conversation

rheatley-pervasid
Copy link
Contributor

Conversation in #104

@zpl-zak zpl-zak requested a review from inlife January 14, 2023 10:38
}

void zpl__json_write_value(zpl_file *f, zpl_adt_node *o, zpl_adt_node *t, zpl_isize indent, zpl_b32 is_inline, zpl_b32 is_last) {
zpl_b8 zpl__json_write_value(zpl_file *f, zpl_adt_node *o, zpl_adt_node *t, zpl_isize indent, zpl_b32 is_inline, zpl_b32 is_last) {

Check warning

Code scanning / CodeQL

Poorly documented large function

Poorly documented function: fewer than 2% comments for a function of 103 lines.
@inlife
Copy link
Member

inlife commented Jan 16, 2023

Overall, it looks fantastic! One of the most essential additions here is the function call status handling which was not part of the library.

We discussed with @zpl-zak that, and so far, it is the most straightforward approach to status handling.

@rheatley-pervasid, what do you think about changing zpl_b8 signature to a custom bool type zpl_result {true/false}? Would that improve the notion of type of return value for the end users of the library?

Thank you so much on all the efforts you've put it!

@rheatley-pervasid
Copy link
Contributor Author

@inlife it is definitely worth more thought. As @zpl-zak pointed out on #104 there are still a lot more functions that would get this attention.
I would be tempted to suggest tackling them first, then if it is clear that zpl_result would cover most cases, it seems attractive. I would also hope, a relatively simple change - almost just a carefully constructed sed.
At this point, I am not confident what percentage of functions can use false/true for failure/success, compared to the opposite model of 1/0 for failure/success.

There are at least a few other functions using a bool return, e.g. ZPL_FILE_*_PROC so I am continuing that paradigm hopefully, rather than starting a new one.

@inlife
Copy link
Member

inlife commented Jan 17, 2023

Ok, I think you are right in the sense that it should be a different task on its own and can be done separately.

Overall I think we are good to merge @zpl-zak 👍

Thank you for the amazing addition @rheatley-pervasid! So far potentially might be one of the biggest additions ever made by a contributor! 🎉🎉

Copy link
Member

@zpl-zak zpl-zak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@zpl-zak zpl-zak merged commit 353c045 into zpl-c:master Jan 20, 2023
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

Successfully merging this pull request may close these issues.

3 participants