diff options
author | Bert Vermeulen <bert@biot.com> | 2013-12-10 02:38:44 +0100 |
---|---|---|
committer | Bert Vermeulen <bert@biot.com> | 2013-12-10 17:22:24 +0100 |
commit | 4d2c7619ec72728dd01999f20ef1004e018d18a4 (patch) | |
tree | 854ef963356dbec0f37aec529629eec55f29a546 /instance.c | |
parent | 7efd37c004833a4f1758bc99623850d89722636d (diff) | |
download | libsigrokdecode-4d2c7619ec72728dd01999f20ef1004e018d18a4.tar.gz libsigrokdecode-4d2c7619ec72728dd01999f20ef1004e018d18a4.zip |
API clarification.
Diffstat (limited to 'instance.c')
-rw-r--r-- | instance.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -412,15 +412,16 @@ SRD_API struct srd_decoder_inst *srd_inst_new(struct srd_session *sess, * Stack a decoder instance on top of another. * * @param sess The session holding the protocol decoder instances. - * @param di_from The instance to move. - * @param di_to The instance on top of which di_from will be stacked. + * @param di_bottom The instance on top of which di_top will be stacked. + * @param di_top The instance to go on top. * * @return SRD_OK upon success, a (negative) error code otherwise. * * @since 0.3.0 */ SRD_API int srd_inst_stack(struct srd_session *sess, - struct srd_decoder_inst *di_from, struct srd_decoder_inst *di_to) + struct srd_decoder_inst *di_bottom, + struct srd_decoder_inst *di_top) { if (session_is_valid(sess) != SRD_OK) { @@ -428,18 +429,20 @@ SRD_API int srd_inst_stack(struct srd_session *sess, return SRD_ERR_ARG; } - if (!di_from || !di_to) { + if (!di_bottom || !di_top) { srd_err("Invalid from/to instance pair."); return SRD_ERR_ARG; } - if (g_slist_find(sess->di_list, di_to)) { + if (g_slist_find(sess->di_list, di_top)) { /* Remove from the unstacked list. */ - sess->di_list = g_slist_remove(sess->di_list, di_to); + sess->di_list = g_slist_remove(sess->di_list, di_top); } /* Stack on top of source di. */ - di_from->next_di = g_slist_append(di_from->next_di, di_to); + di_bottom->next_di = g_slist_append(di_bottom->next_di, di_top); + + srd_dbg("Stacked %s on top of %s.", di_top->inst_id, di_bottom->inst_id); return SRD_OK; } |