On 29.09.2025 14:07, Anthony PERARD wrote:
> @@ -88,13 +95,56 @@ static char *qmp_get_block_image(xenstat_node *node, char
> *qmp_devname, int qfd)
> };
> const char *ptr[] = {0, 0};
> unsigned char *qmp_stats;
> - yajl_val info, ret_obj, dev_obj, n;
> int i;
>
> if ((qmp_stats = qmp_query(qfd, query_block_cmd)) == NULL)
> return NULL;
>
> +#ifdef HAVE_LIBJSONC
> + json_object *jso;
> + enum json_tokener_error error;
> + jso = json_tokener_parse_verbose((const char *)qmp_stats, &error);
> + free(qmp_stats);
> + if (jso == NULL)
> + return NULL;
> +
> + ptr[0] = qblock[QMP_BLOCK_RETURN]; /* "return" */
> + json_object *ret_jso = json_object_object_get(jso, ptr[0]);
> + if (ret_jso == NULL)
> + goto done;
> +
> + for (i=0; i<json_object_array_length(ret_jso); i++) {
> + json_object *n = json_object_array_get_idx(ret_jso, i);
> +
> + ptr[0] = qblock[QMP_BLOCK_DEVICE]; /* "device" */
> + json_object *dev_jso = json_object_object_get(n, ptr[0]);
This causes the build to fail for me when building with version 0.12.1 of the
library. The function is marked deprecated there, suggesting to use
json_object_object_get_ex() instead. The deprecation was undone in May 2016,
so we may need to cope with the deprecation (or avoid using the library in
that case).
Jan