Move srd_check_init() to decoder.c and make it static.
[libsigrokdecode.git] / decoder.c
index 4b3263846587de3e74dbc17dc9c3184b0a368c18..79ba8ef9db65344118b94a98b5b56299acfbd251 100644 (file)
--- a/decoder.c
+++ b/decoder.c
@@ -47,12 +47,22 @@ extern GSList *searchpaths;
 
 /* session.c */
 extern GSList *sessions;
+extern int max_session_id;
 
 /* module_sigrokdecode.c */
 extern SRD_PRIV PyObject *mod_sigrokdecode;
 
 /** @endcond */
 
+static gboolean srd_check_init(void)
+{
+       if (max_session_id < 0) {
+               srd_err("Library is not initialized.");
+               return FALSE;
+       } else
+               return TRUE;
+}
+
 /**
  * Returns the list of supported/loaded protocol decoders.
  *