* Unload the specified protocol decoder. * * @param dec The struct srd_decoder to be unloaded. * * @return SRD_OK upon success, a (negative) error code otherwise. * * @since 0.1.0 */
| 987 | * @since 0.1.0 |
| 988 | */ |
| 989 | SRD_API int srd_decoder_unload(struct srd_decoder *dec) |
| 990 | { |
| 991 | struct srd_session *sess; |
| 992 | GSList *l; |
| 993 | |
| 994 | if (!srd_check_init()) |
| 995 | return SRD_ERR; |
| 996 | |
| 997 | if (!dec) |
| 998 | return SRD_ERR_ARG; |
| 999 | |
| 1000 | /* |
| 1001 | * Since any instances of this decoder need to be released as well, |
| 1002 | * but they could be anywhere in the stack, just free the entire |
| 1003 | * stack. A frontend reloading a decoder thus has to restart all |
| 1004 | * instances, and rebuild the stack. |
| 1005 | */ |
| 1006 | for (l = sessions; l; l = l->next) { |
| 1007 | sess = l->data; |
| 1008 | srd_inst_free_all(sess); |
| 1009 | } |
| 1010 | |
| 1011 | /* Remove the PD from the list of loaded decoders. */ |
| 1012 | pd_list = g_slist_remove(pd_list, dec); |
| 1013 | |
| 1014 | decoder_free(dec); |
| 1015 | |
| 1016 | return SRD_OK; |
| 1017 | } |
| 1018 | |
| 1019 | static void srd_decoder_load_all_zip_path(char *zip_path) |
| 1020 | { |
no test coverage detected