X-Git-Url: http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=instance.c;fp=instance.c;h=23732ddb3ad1645825aa389c61d2dfa413055206;hp=99c5012886b48750f4bcd4f23ac2ffdfbf872666;hb=369e82655340777c7fbf03847c8ffe73ad05af5a;hpb=6cbba91f23b9f9ace75b4722c9c0776b9211008d diff --git a/instance.c b/instance.c index 99c5012..23732dd 100644 --- a/instance.c +++ b/instance.c @@ -529,6 +529,27 @@ SRD_API int srd_inst_stack(struct srd_session *sess, sess->di_list = g_slist_remove(sess->di_list, di_top); } + /* + * Check if there's at least one matching input/output pair + * for the stacked PDs. We warn if that's not the case, but it's + * not a hard error for the time being. + */ + gboolean at_least_one_match = FALSE; + for (GSList *out = di_bottom->decoder->outputs; out; out = out->next) { + const char *o = out->data; + for (GSList *in = di_top->decoder->inputs; in; in = in->next) { + const char *i = in->data; + if (!strcmp(o, i)) { + at_least_one_match = TRUE; + break; + } + } + } + + if (!at_least_one_match) + srd_warn("No matching in-/output when stacking %s onto %s.", + di_top->inst_id, di_bottom->inst_id); + /* Stack on top of source di. */ di_bottom->next_di = g_slist_append(di_bottom->next_di, di_top);