X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Foutput_ols.c;h=5097de4b4c05a90f1f744c3e7025dab97be3b1e1;hb=0e3b143994797cd4685526b9a739089fe83385cf;hp=966eb0b75e0dffe42849db14f5d2dd8850c2dd9c;hpb=54ac5277c5e462f1778300b9bc3fdd4709ecb2dc;p=libsigrok.git diff --git a/output/output_ols.c b/output/output_ols.c index 966eb0b7..5097de4b 100644 --- a/output/output_ols.c +++ b/output/output_ols.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "config.h" struct context { @@ -37,17 +38,18 @@ struct context { unsigned int unitsize; }; - static int init(struct sr_output *o) { struct context *ctx; struct sr_probe *probe; GSList *l; uint64_t samplerate; - int num_enabled_probes, i; + 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; @@ -71,8 +73,6 @@ static int init(struct sr_output *o) g_string_append_printf(ctx->header, ";EnabledChannels: -1\n"); g_string_append_printf(ctx->header, ";Compressed: true\n"); g_string_append_printf(ctx->header, ";CursorEnabled: false\n"); - for (i = 0; i < 10; i++) - g_string_append_printf(ctx->header, ";Cursor%d: 0\n", i); return SR_OK; } @@ -127,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, };