Add json_add_number manually overloaded function

This commit is contained in:
ktkk 2026-06-05 14:35:07 +00:00
parent a449c00f16
commit 0a0a6d918d
2 changed files with 20 additions and 0 deletions

8
json.h
View file

@ -41,5 +41,13 @@ void json_add_double(Json* json, double value);
void json_add_bool(Json* json, bool value);
void json_add_null(Json* json);
#define json_add_number(json, value) \
_Generic( \
(value), \
int: json_add_long((json), (long)value), \
long: json_add_long((json), value), \
float: json_add_double((json), (double)value), \
double: json_add_double((json), value))
#endif // JSON_H