Allow output_format.init() to return errors.

This commit is contained in:
Uwe Hermann 2010-04-05 16:20:09 +02:00
parent 4c100f3244
commit 5a8fda158b
4 changed files with 12 additions and 12 deletions

View File

@ -23,11 +23,9 @@
static void init(struct output *o)
static int init(struct output *o)
{
return 0;
}

View File

@ -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);
}

View File

@ -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,

View File

@ -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,