diff -r 53e22f112b11 -r 15b3ca7ee33f src/cx/json.h --- a/src/cx/json.h Tue Nov 12 17:34:04 2024 +0100 +++ b/src/cx/json.h Mon Nov 18 22:05:42 2024 +0100 @@ -183,6 +183,36 @@ cx_attr_access_r(2, 3) int cxJsonFilln(CxJson *json, const char *buf, size_t len); +#ifdef __cplusplus +} // extern "C" + +cx_attr_nonnull +static inline int cxJsonFill( + CxJson *json, + cxstring str +) { + return cxJsonFilln(json, str.ptr, str.length); +} + +cx_attr_nonnull +static inline int cxJsonFill( + CxJson *json, + cxmutstr str +) { + return cxJsonFilln(json, str.ptr, str.length); +} + +cx_attr_nonnull +cx_attr_cstr_arg(2) +static inline int cxJsonFill( + CxJson *json, + const char *str +) { + return cxJsonFilln(json, str, strlen(str)); +} + +extern "C" { +#else // __cplusplus #define cxJsonFill(json, str) _Generic((str), \ cxstring: cx_json_fill_cxstr, \ cxmutstr: cx_json_fill_mutstr, \ @@ -214,6 +244,7 @@ ) { return cxJsonFilln(json, str, strlen(str)); } +#endif void cxJsonValueFree(CxJsonValue *value);