cffi: always return config values as JSON
Previously, string JSON values were special cased to be provided as bare strings, which means that CFFI modules have to either know what type each value is expected to be, or use a heuristic such as trying to decode and then treating the value as a string on failure. Instead, we can always return JSON, and let the downstream consumer handle deserialising the value into whatever type is expected. The new behaviour is gated on a new ABI version 2: modules built against version 1 will continue to get the old behaviour.
This commit is contained in:
@ -17,7 +17,7 @@ void onclicked(GtkButton* button) {
|
||||
}
|
||||
|
||||
// You must
|
||||
const size_t wbcffi_version = 1;
|
||||
const size_t wbcffi_version = 2;
|
||||
|
||||
void* wbcffi_init(const wbcffi_init_info* init_info, const wbcffi_config_entry* config_entries,
|
||||
size_t config_entries_len) {
|
||||
@ -67,4 +67,4 @@ void wbcffi_refresh(void* instance, int signal) {
|
||||
|
||||
void wbcffi_doaction(void* instance, const char* name) {
|
||||
printf("cffi_example inst=%p: doAction(%s)\n", instance, name);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user