From: Pavel Rochnyack Date: Mon, 3 Dec 2018 10:16:17 +0000 (+0700) Subject: ovs_stats: Fix indent X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=7d26115313e293097a2908a3177ab043dca9cd0f;p=collectd.git ovs_stats: Fix indent --- diff --git a/src/ovs_stats.c b/src/ovs_stats.c index 9b958d83..d73b54d7 100644 --- a/src/ovs_stats.c +++ b/src/ovs_stats.c @@ -873,20 +873,21 @@ static int ovs_stats_update_iface_stats(interface_list_t *iface, static int ovs_stats_update_iface_ext_ids(interface_list_t *iface, yajl_val ext_ids) { - if (ext_ids && YAJL_IS_ARRAY(ext_ids)) { - for (size_t i = 0; i < YAJL_GET_ARRAY(ext_ids)->len; i++) { - yajl_val ext_id = YAJL_GET_ARRAY(ext_ids)->values[i]; - if (!YAJL_IS_ARRAY(ext_id)) - return -1; + if (!ext_ids || !YAJL_IS_ARRAY(ext_ids)) + return 0; - char *key = YAJL_GET_STRING(YAJL_GET_ARRAY(ext_id)->values[0]); - char *value = YAJL_GET_STRING(YAJL_GET_ARRAY(ext_id)->values[1]); - if (key && value) { - if (strncmp(key, "iface-id", strlen(key)) == 0) { - sstrncpy(iface->ex_iface_id, value, sizeof(iface->ex_iface_id)); - } else if (strncmp(key, "vm-uuid", strlen(key)) == 0) { - sstrncpy(iface->ex_vm_id, value, sizeof(iface->ex_vm_id)); - } + for (size_t i = 0; i < YAJL_GET_ARRAY(ext_ids)->len; i++) { + yajl_val ext_id = YAJL_GET_ARRAY(ext_ids)->values[i]; + if (!YAJL_IS_ARRAY(ext_id)) + return -1; + + char *key = YAJL_GET_STRING(YAJL_GET_ARRAY(ext_id)->values[0]); + char *value = YAJL_GET_STRING(YAJL_GET_ARRAY(ext_id)->values[1]); + if (key && value) { + if (strncmp(key, "iface-id", strlen(key)) == 0) { + sstrncpy(iface->ex_iface_id, value, sizeof(iface->ex_iface_id)); + } else if (strncmp(key, "vm-uuid", strlen(key)) == 0) { + sstrncpy(iface->ex_vm_id, value, sizeof(iface->ex_vm_id)); } } }