return ret;
}
+/**
+ * Sanity-check all libsigrok transform modules.
+ *
+ * @retval SR_OK All modules are OK
+ * @retval SR_ERR One or more modules have issues.
+ */
+static int sanity_check_all_transform_modules(void)
+{
+ int i, errors, ret = SR_OK;
+ const struct sr_transform_module **transforms;
+ const char *d;
+
+ sr_spew("Sanity-checking all transform modules.");
+
+ transforms = sr_transform_list();
+ for (i = 0; transforms[i]; i++) {
+ errors = 0;
+
+ d = (transforms[i]->id) ? transforms[i]->id : "NULL";
+
+ if (!transforms[i]->id) {
+ sr_err("No ID in module %d ('%s').", i, d);
+ errors++;
+ }
+ if (!transforms[i]->name) {
+ sr_err("No name in module %d ('%s').", i, d);
+ errors++;
+ }
+ if (!transforms[i]->desc) {
+ sr_err("No description in module '%s'.", d);
+ errors++;
+ }
+ /* Note: options() is optional. */
+ /* Note: init() is optional. */
+ if (!transforms[i]->receive) {
+ sr_err("No receive in module '%s'.", d);
+ errors++;
+ }
+ /* Note: cleanup() is optional. */
+
+ if (errors == 0)
+ continue;
+
+ ret = SR_ERR;
+ }
+
+ return ret;
+}
+
/**
* Initialize libsigrok.
*
return ret;
}
+ if (sanity_check_all_transform_modules() < 0) {
+ sr_err("Internal transform module error(s), aborting.");
+ return ret;
+ }
+
/* + 1 to handle when struct sr_context has no members. */
context = g_malloc0(sizeof(struct sr_context) + 1);