summaryrefslogtreecommitdiff
path: root/instance.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-01-31 00:13:32 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2014-01-31 00:13:32 +0100
commit9bf7f71c8e29328bda5689d79b412cc0dde9fbe9 (patch)
treeddf80ee5bfe1fc7a6c458851fa25e9b1a58ce461 /instance.c
parentc515eed7ef7a04a42b5b34abd308e08d6942835e (diff)
downloadlibsigrokdecode-9bf7f71c8e29328bda5689d79b412cc0dde9fbe9.tar.gz
libsigrokdecode-9bf7f71c8e29328bda5689d79b412cc0dde9fbe9.zip
srd_inst_probe_set_all: Error out upon missing required probes.
Diffstat (limited to 'instance.c')
-rw-r--r--instance.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/instance.c b/instance.c
index ab813e6..594f144 100644
--- a/instance.c
+++ b/instance.c
@@ -305,6 +305,16 @@ SRD_API int srd_inst_probe_set_all(struct srd_decoder_inst *di,
(i < num_required_probes) ? "required" : "optional");
}
+ /* Report an error if not all required probes were specified. */
+ for (i = 0; i < num_required_probes; i++) {
+ if (new_probemap[i] != -1)
+ continue;
+ p = g_slist_nth(di->decoder->probes, i)->data;
+ srd_err("Required probe '%s' (index %d) was not specified.",
+ p->id, i);
+ return SRD_ERR;
+ }
+
g_free(di->dec_probemap);
di->dec_probemap = new_probemap;