mirror of
https://github.com/swaywm/sway.git
synced 2026-05-03 06:46:26 -04:00
json-c: add support for both 0.12.1 and 0.13
This commit is contained in:
parent
7dad5cd18c
commit
27034ba7f6
2 changed files with 5 additions and 1 deletions
|
|
@ -18,7 +18,7 @@ datadir = get_option('datadir')
|
||||||
sysconfdir = get_option('sysconfdir')
|
sysconfdir = get_option('sysconfdir')
|
||||||
prefix = get_option('prefix')
|
prefix = get_option('prefix')
|
||||||
|
|
||||||
jsonc = dependency('json-c', version: '>=0.13')
|
jsonc = dependency('json-c', version: '>=0.12.1')
|
||||||
pcre = dependency('libpcre')
|
pcre = dependency('libpcre')
|
||||||
wlroots = dependency('wlroots')
|
wlroots = dependency('wlroots')
|
||||||
wayland_server = dependency('wayland-server')
|
wayland_server = dependency('wayland-server')
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,11 @@ static void pretty_print_version(json_object *v) {
|
||||||
static void pretty_print_clipboard(json_object *v) {
|
static void pretty_print_clipboard(json_object *v) {
|
||||||
if (success(v, true)) {
|
if (success(v, true)) {
|
||||||
if (json_object_is_type(v, json_type_array)) {
|
if (json_object_is_type(v, json_type_array)) {
|
||||||
|
#if JSON_C_MAJOR_VERSION > 0 || JSON_C_MINOR_VERSION >= 13
|
||||||
for (size_t i = 0; i < json_object_array_length(v); ++i) {
|
for (size_t i = 0; i < json_object_array_length(v); ++i) {
|
||||||
|
#else
|
||||||
|
for (int i = 0; i < json_object_array_length(v); ++i) {
|
||||||
|
#endif
|
||||||
json_object *o = json_object_array_get_idx(v, i);
|
json_object *o = json_object_array_get_idx(v, i);
|
||||||
printf("%s\n", json_object_get_string(o));
|
printf("%s\n", json_object_get_string(o));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue