api/options: cleanup the fixup

This commit is contained in:
Björn Linse
2020-12-04 10:59:58 +01:00
parent ced951c2aa
commit 17a58043a3
4 changed files with 97 additions and 69 deletions

View File

@@ -16,6 +16,7 @@
#define BOOLEAN_OBJ(b) ((Object) { \
.type = kObjectTypeBoolean, \
.data.boolean = b })
#define BOOL(b) BOOLEAN_OBJ(b)
#define INTEGER_OBJ(i) ((Object) { \
.type = kObjectTypeInteger, \
@@ -29,6 +30,8 @@
.type = kObjectTypeString, \
.data.string = s })
#define CSTR_TO_OBJ(s) STRING_OBJ(cstr_to_string(s))
#define BUFFER_OBJ(s) ((Object) { \
.type = kObjectTypeBuffer, \
.data.integer = s })
@@ -59,6 +62,8 @@
#define PUT(dict, k, v) \
kv_push(dict, ((KeyValuePair) { .key = cstr_to_string(k), .value = v }))
#define PUT_BOOL(dict, name, condition) PUT(dict, name, BOOLEAN_OBJ(condition));
#define ADD(array, item) \
kv_push(array, item)