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
json_object_<type>_set(json_object *o,<type> value) API for value setting in json object private structure #269
Comments
At first glance that seems reasonable, at least for primitive types. I'd say follow the the pattern json_object_set_ instead, to be consistent with existing naming. |
I've started a fork for the future merge request. The fist function is "done" with this commit ALLTERCO@fae0945 |
json_bool should not be used as a return type to indicate success or failure. If you're going to do that, it should return an int, and use plain 1/0 constants instead of TRUE/FALSE. |
It is non trivial to return string value and it is memory leak prone. I prefer switching to 1 - "value" set and 0 - "error" semantic. |
Oh, right, handling that would mean a different approach for the string function. Ok, let's have these just return a 0/1, and if you need the previous value you can always do a ...get... call just before the ...set... |
This will be really useful if you have a JSON representation of some internal state and when the state changes at the moment there is no way to change the JSON representation other than recreating the whole JSON tree which is suboptimal.
Implementation is quite easy if you don't switch actual object types which will be enough for may specific itch that I'm willing to scratch it is OKed by the mainteners 😄
The text was updated successfully, but these errors were encountered: