MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / srd_inst_find_by_id_stack

Function srd_inst_find_by_id_stack

libsigrokdecode4DSL/instance.c:590–612  ·  view source on GitHub ↗

* Search a decoder instance and its stack for instance ID. * * @param[in] inst_id ID to search for. * @param[in] stack A decoder instance, potentially with stacked instances. * * @return The matching instance, or NULL. */

Source from the content-addressed store, hash-verified

588 * @return The matching instance, or NULL.
589 */
590static struct srd_decoder_inst *srd_inst_find_by_id_stack(const char *inst_id,
591 struct srd_decoder_inst *stack)
592{
593 const GSList *l;
594 struct srd_decoder_inst *tmp, *di;
595
596 if (!strcmp(stack->inst_id, inst_id))
597 return stack;
598
599 /* Otherwise, look recursively in our stack. */
600 di = NULL;
601 if (stack->next_di) {
602 for (l = stack->next_di; l; l = l->next) {
603 tmp = l->data;
604 if (!strcmp(tmp->inst_id, inst_id)) {
605 di = tmp;
606 break;
607 }
608 }
609 }
610
611 return di;
612}
613
614/**
615 * Find a decoder instance by its instance ID.

Callers 1

srd_inst_find_by_idFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected