]> sigrok.org Git - libsigrokdecode.git/commitdiff
srd_inst_probe_set_all: Error out upon missing required probes.
authorUwe Hermann <redacted>
Thu, 30 Jan 2014 23:13:32 +0000 (00:13 +0100)
committerUwe Hermann <redacted>
Thu, 30 Jan 2014 23:13:32 +0000 (00:13 +0100)
instance.c

index ab813e66ea9616a5c8e72549252c3514651ab323..594f144edcabe9dc44ec3a60265e3b5a257ecfa3 100644 (file)
@@ -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;