X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=srd.c;h=68cfe0aa0b786adcd2eca26628cda2e58efaa667;hp=07d79523ae859dd3d8de5d5e7d71ce0455dcf220;hb=c357abd198bd195cb9ea015130dc76c8c7a33651;hpb=190b71cfebc1dd000d3203c7300a10afd96c1201 diff --git a/srd.c b/srd.c index 07d7952..68cfe0a 100644 --- a/srd.c +++ b/srd.c @@ -18,22 +18,19 @@ * along with this program. If not, see . */ -#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */ -#include "libsigrokdecode-internal.h" +#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */ +#include "libsigrokdecode.h" #include "config.h" #include /** @cond PRIVATE */ -/* session.c */ -extern GSList *sessions; -extern int max_session_id; - -/* decoder.c */ -extern SRD_PRIV GSList *pd_list; +/* Python module search paths */ +SRD_PRIV GSList *searchpaths = NULL; -/* module_sigrokdecode.c */ -extern PyMODINIT_FUNC PyInit_sigrokdecode(void); +/* session.c */ +extern SRD_PRIV GSList *sessions; +extern SRD_PRIV int max_session_id; /** @endcond */ @@ -65,7 +62,7 @@ extern PyMODINIT_FUNC PyInit_sigrokdecode(void); * * @section sec_mailinglists Mailing lists * - * There are two mailing lists for sigrok/libsigrokdecode: sigrok-devel and sigrok-commits. + * There is one mailing list for sigrok/libsigrokdecode: sigrok-devel. * * @section sec_irc IRC * @@ -194,8 +191,8 @@ SRD_API int srd_exit(void) srd_session_destroy((struct srd_session *)l->data); srd_decoder_unload_all(); - g_slist_free(pd_list); - pd_list = NULL; + g_slist_free_full(searchpaths, g_free); + searchpaths = NULL; /* Py_Finalize() returns void, any finalization errors are ignored. */ Py_Finalize(); @@ -251,14 +248,12 @@ SRD_PRIV int srd_decoder_searchpath_add(const char *path) /* Convert to wide chars. */ wc_len = sizeof(wchar_t) * (new_path->len + 1); - if (!(wc_new_path = g_try_malloc(wc_len))) { - srd_dbg("malloc failed"); - return SRD_ERR_MALLOC; - } + wc_new_path = g_malloc(wc_len); mbstowcs(wc_new_path, new_path->str, wc_len); PySys_SetPath(wc_new_path); g_string_free(new_path, TRUE); g_free(wc_new_path); + searchpaths = g_slist_append(searchpaths, g_strdup(path)); return SRD_OK; }