From 5b64737ad9f5da4b3c9bd429f1fa675ed7a4dc87 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 24 Mar 2023 15:27:12 +0100 Subject: [PATCH] Fix pcf_labels type --- src/emu/nanos6/breakdown.c | 18 +++++++++++++----- src/emu/nanos6/nanos6_priv.h | 2 +- src/emu/nanos6/setup.c | 8 ++++---- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/emu/nanos6/breakdown.c b/src/emu/nanos6/breakdown.c index 1fd6102..f11093d 100644 --- a/src/emu/nanos6/breakdown.c +++ b/src/emu/nanos6/breakdown.c @@ -217,7 +217,7 @@ model_nanos6_breakdown_connect(struct emu *emu) int model_nanos6_breakdown_finish(struct emu *emu, - const struct pcf_value_label (**labels)[]) + const struct pcf_value_label **labels) { if (emu->args.breakdown == 0) return 0; @@ -231,12 +231,20 @@ model_nanos6_breakdown_finish(struct emu *emu, const struct pcf_value_label *v = NULL; /* Emit subsystem values */ - for (v = *labels[CH_SUBSYSTEM]; v->label; v++) - pcf_add_value(pcftype, v->value, v->label); + for (v = labels[CH_SUBSYSTEM]; v->label; v++) { + if (pcf_add_value(pcftype, v->value, v->label) != 0) { + err("pcf_add_value failed"); + return -1; + } + } /* Emit idle values */ - for (v = *labels[CH_IDLE]; v->label; v++) - pcf_add_value(pcftype, v->value, v->label); + for (v = labels[CH_IDLE]; v->label; v++) { + if (pcf_add_value(pcftype, v->value, v->label) != 0) { + err("pcf_add_value failed"); + return -1; + } + } /* Emit task_type values */ struct system *sys = &emu->system; diff --git a/src/emu/nanos6/nanos6_priv.h b/src/emu/nanos6/nanos6_priv.h index 1b12a47..8fce2df 100644 --- a/src/emu/nanos6/nanos6_priv.h +++ b/src/emu/nanos6/nanos6_priv.h @@ -98,6 +98,6 @@ int model_nanos6_finish(struct emu *emu); int model_nanos6_breakdown_create(struct emu *emu); int model_nanos6_breakdown_connect(struct emu *emu); int model_nanos6_breakdown_finish(struct emu *emu, - const struct pcf_value_label (**labels)[]); + const struct pcf_value_label **labels); #endif /* NANOS6_PRIV_H */ diff --git a/src/emu/nanos6/setup.c b/src/emu/nanos6/setup.c index 7f9b8f0..e58dcd0 100644 --- a/src/emu/nanos6/setup.c +++ b/src/emu/nanos6/setup.c @@ -131,10 +131,10 @@ static const struct pcf_value_label nanos6_worker_idle[] = { { -1, NULL }, }; -static const struct pcf_value_label (*pcf_labels[CH_MAX])[] = { - [CH_SUBSYSTEM] = &nanos6_ss_values, - [CH_THREAD] = &nanos6_thread_type, - [CH_IDLE] = &nanos6_worker_idle, +static const struct pcf_value_label *pcf_labels[CH_MAX] = { + [CH_SUBSYSTEM] = nanos6_ss_values, + [CH_THREAD] = nanos6_thread_type, + [CH_IDLE] = nanos6_worker_idle, }; static const long prv_flags[CH_MAX] = {