]> sigrok.org Git - libsigrok.git/blobdiff - output/output_ols.c
Change left-over SIGROK_* to SR_*.
[libsigrok.git] / output / output_ols.c
index dd9ffdf672f7e5d1b3ccaafb1aea4638df5ab2c9..5097de4b4c05a90f1f744c3e7025dab97be3b1e1 100644 (file)
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <glib.h>
 #include <sigrok.h>
+#include <sigrok-internal.h>
 #include "config.h"
 
 struct context {
@@ -45,8 +46,10 @@ static int init(struct sr_output *o)
        uint64_t samplerate;
        int num_enabled_probes;
 
-       if (!(ctx = g_malloc(sizeof(struct context))))
+       if (!(ctx = g_try_malloc(sizeof(struct context)))) {
+               sr_err("ols out: %s: ctx malloc failed", __func__);
                return SR_ERR_MALLOC;
+       }
        o->internal = ctx;
 
        ctx->num_samples = 0;
@@ -124,10 +127,10 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
 }
 
 struct sr_output_format output_ols = {
-       "ols",
-       "OpenBench Logic Sniffer",
-       SR_DF_LOGIC,
-       init,
-       data,
-       event,
+       .id = "ols",
+       .description = "OpenBench Logic Sniffer",
+       .df_type = SR_DF_LOGIC,
+       .init = init,
+       .data = data,
+       .event = event,
 };