-
Notifications
You must be signed in to change notification settings - Fork 290
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
Fix header files #109
Fix header files #109
Conversation
json.h: <inttypes.h> → <stdint.h> int64_t is defined in <stdint.h>, no need for the full <inttypes.h> json.h: <stdlib.h> → <stddef.h> <stddef.h> is enough to define size_t json.c: <stdlib.h> Now that <stdlib.h> has been removed from json.h, add it to json.c for malloc()/calloc() and free()
4fd8af8
to
b5ce13e
Compare
Note that this patch does not change the status of the library regarding ANSI C vs. C89 compatibility:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! After doing some more thinking and research, perhaps it would be better to use a progressive-enhancement approach where we check the presence and value of __STDC_VERSION__
to know what is safe to use. I think also we should stick to long
/long long
/int_fast64_t
since int64_t
and co are optional and not guaranteed to exist. Though, that might be better suited to a different commit, as there are more places than just here that use int64_t
. The user can also override the default by defining json_int_t
, which I hope to add proper documentation for later. Thoughts?
Also, would you like your name added to the AUTHORS
file? You may add it yourself or I will add it for you, or you can opt-out, whichever you prefer.
I agree:
However, I also agree the above ideas are orthogonal to the current patch, which is about using the proper header files without changing the status with respect to ANSI C or |
Good point, I'll go ahead and merge this PR in that case. Yes or no to |
I've submitted another PR for AUTHORS. |
json.h:
<inttypes.h>
→<stdint.h>
int64_t
is defined in<stdint.h>
, no need for the full<inttypes.h>
json.h:
<stdlib.h>
→<stddef.h>
<stddef.h>
is enough to definesize_t
json.c:
<stdlib.h>
Now that
<stdlib.h>
has been removed from json.h, add it to json.c for malloc()/calloc() and free()