From: Uwe Hermann Date: Mon, 5 Apr 2010 14:20:09 +0000 (+0200) Subject: Allow output_format.init() to return errors. X-Git-Tag: libsigrok-0.1.0~586 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5a8fda158bd9cc040b36fb3b016808c59ccf89f3;p=libsigrok.git Allow output_format.init() to return errors. --- diff --git a/output/output_skeleton.c b/output/output_skeleton.c index 6bd885f9..24cada4a 100644 --- a/output/output_skeleton.c +++ b/output/output_skeleton.c @@ -23,11 +23,9 @@ -static void init(struct output *o) +static int init(struct output *o) { - - - + return 0; } diff --git a/output/output_text.c b/output/output_text.c index 0507e02c..914e51fc 100644 --- a/output/output_text.c +++ b/output/output_text.c @@ -66,7 +66,7 @@ static void flush_linebufs(struct context *ctx, GSList *probes, char *outbuf) } -static void init(struct output *o, int default_spl) +static int init(struct output *o, int default_spl) { struct context *ctx; struct probe *probe; @@ -109,6 +109,7 @@ static void init(struct output *o, int default_spl) ctx->linebuf = calloc(1, num_probes * ctx->linebuf_len); ctx->linevalues = calloc(1, num_probes); + return 0; } @@ -137,10 +138,10 @@ static int event(struct output *o, int event_type, char **data_out, uint64_t *le } -static void init_binary(struct output *o) +static int init_binary(struct output *o) { - init(o, DEFAULT_BPL_BIN); + return init(o, DEFAULT_BPL_BIN); } @@ -199,10 +200,10 @@ static int data_binary(struct output *o, char *data_in, uint64_t length_in, char } -static void init_hex(struct output *o) +static int init_hex(struct output *o) { - init(o, DEFAULT_BPL_BIN); + return init(o, DEFAULT_BPL_BIN); } diff --git a/output/output_vcd.c b/output/output_vcd.c index c9eba1bb..0d8d9d31 100644 --- a/output/output_vcd.c +++ b/output/output_vcd.c @@ -30,7 +30,6 @@ struct context { char *probelist[65]; int *prevbits; char *header; - char *data; }; const char *vcd_header = "\ @@ -44,7 +43,7 @@ $upscope $end\n\ $enddefinitions $end\n\ $dumpvars\n"; -static void init(struct output *o) +static int init(struct output *o) { /* Maximum header length */ #define MAX_HEADER_LEN 2048 @@ -100,6 +99,8 @@ static void init(struct output *o) (char *)&sbuf, 1, "ns", PACKAGE, (char *)&wbuf); ctx->prevbits = calloc(sizeof(int), num_probes); + + return 0; } static int event(struct output *o, int event_type, char **data_out, diff --git a/sigrok.h b/sigrok.h index cf5cb61f..1d11aff7 100644 --- a/sigrok.h +++ b/sigrok.h @@ -99,7 +99,7 @@ struct output { struct output_format { char *extension; char *description; - void (*init) (struct output *o); + int (*init) (struct output *o); int (*data) (struct output *o, char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out); int (*event) (struct output *o, int event_type, char **data_out,