Remove function prefix from err()

This commit is contained in:
Rodrigo Arias 2023-03-21 11:01:54 +01:00 committed by Rodrigo Arias Mallo
parent 9cb752e102
commit 5a03fd49e9
6 changed files with 22 additions and 27 deletions

View File

@ -59,14 +59,13 @@ bay_register(struct bay *bay, struct chan *chan)
{ {
struct bay_chan *bchan = find_bay_chan(bay, chan->name); struct bay_chan *bchan = find_bay_chan(bay, chan->name);
if (bchan != NULL) { if (bchan != NULL) {
err("bay_register: channel %s already registered\n", err("channel %s already registered", chan->name);
chan->name);
return -1; return -1;
} }
bchan = calloc(1, sizeof(struct bay_chan)); bchan = calloc(1, sizeof(struct bay_chan));
if (bchan == NULL) { if (bchan == NULL) {
err("bay_register: calloc failed\n"); err("calloc failed:");
return -1; return -1;
} }
@ -87,14 +86,12 @@ bay_remove(struct bay *bay, struct chan *chan)
{ {
struct bay_chan *bchan = find_bay_chan(bay, chan->name); struct bay_chan *bchan = find_bay_chan(bay, chan->name);
if (bchan == NULL) { if (bchan == NULL) {
err("bay_remove: channel %s not registered\n", err("channel %s not registered", chan->name);
chan->name);
return -1; return -1;
} }
if (bchan->is_dirty) { if (bchan->is_dirty) {
err("bay_remove: cannot remote bay channel %s in dirty state\n", err("cannot remote bay channel %s in dirty state", chan->name);
chan->name);
return -1; return -1;
} }
@ -195,7 +192,7 @@ propagate_chan(struct bay_chan *bchan, enum bay_cb_type type)
DL_FOREACH(bchan->cb[type], cur) { DL_FOREACH(bchan->cb[type], cur) {
dbg("calling cb %p", cur->func); dbg("calling cb %p", cur->func);
if (cur->func(bchan->chan, cur->arg) != 0) { if (cur->func(bchan->chan, cur->arg) != 0) {
err("propagate_chan: callback failed\n"); err("callback failed");
return -1; return -1;
} }
} }
@ -211,7 +208,7 @@ bay_propagate(struct bay *bay)
DL_FOREACH(bay->dirty, cur) { DL_FOREACH(bay->dirty, cur) {
/* May add more dirty channels */ /* May add more dirty channels */
if (propagate_chan(cur, BAY_CB_DIRTY) != 0) { if (propagate_chan(cur, BAY_CB_DIRTY) != 0) {
err("bay_propagate: propagate_chan failed\n"); err("propagate_chan failed");
return -1; return -1;
} }
} }
@ -224,7 +221,7 @@ bay_propagate(struct bay *bay)
DL_FOREACH(bay->dirty, cur) { DL_FOREACH(bay->dirty, cur) {
/* Cannot add more dirty channels */ /* Cannot add more dirty channels */
if (propagate_chan(cur, BAY_CB_EMIT) != 0) { if (propagate_chan(cur, BAY_CB_EMIT) != 0) {
err("bay_propagate: propagate_chan failed\n"); err("propagate_chan failed");
return -1; return -1;
} }
} }
@ -237,7 +234,7 @@ bay_propagate(struct bay *bay)
bay->state = BAY_FLUSHING; bay->state = BAY_FLUSHING;
DL_FOREACH(bay->dirty, cur) { DL_FOREACH(bay->dirty, cur) {
if (chan_flush(cur->chan) != 0) { if (chan_flush(cur->chan) != 0) {
err("bay_propagate: chan_flush failed\n"); err("chan_flush failed");
return -1; return -1;
} }
cur->is_dirty = 0; cur->is_dirty = 0;

View File

@ -119,13 +119,13 @@ int
clkoff_load(struct clkoff *table, FILE *file) clkoff_load(struct clkoff *table, FILE *file)
{ {
if (cparse(table, file) != 0) { if (cparse(table, file) != 0) {
err("clkoff_load: failed parsing clock table\n"); err("failed parsing clock table");
return -1; return -1;
} }
/* Create index array */ /* Create index array */
if (cindex(table) != 0) { if (cindex(table) != 0) {
err("clkoff_load: failed indexing table\n"); err("failed indexing table");
return -1; return -1;
} }

View File

@ -62,7 +62,7 @@ cb_select(struct chan *sel_chan, void *ptr)
struct value sel_value; struct value sel_value;
if (chan_read(sel_chan, &sel_value) != 0) { if (chan_read(sel_chan, &sel_value) != 0) {
err("cb_select: chan_read(select) failed\n"); err("chan_read(select) failed");
return -1; return -1;
} }
@ -96,12 +96,12 @@ cb_select(struct chan *sel_chan, void *ptr)
/* Set to null by default */ /* Set to null by default */
struct value out_value = value_null(); struct value out_value = value_null();
if (input != NULL && chan_read(input->chan, &out_value) != 0) { if (input != NULL && chan_read(input->chan, &out_value) != 0) {
err("cb_select: chan_read() failed\n"); err("chan_read() failed");
return -1; return -1;
} }
if (chan_set(mux->output, out_value) != 0) { if (chan_set(mux->output, out_value) != 0) {
err("cb_select: chan_set() failed\n"); err("chan_set() failed");
return -1; return -1;
} }
@ -143,24 +143,22 @@ mux_init(struct mux *mux,
int64_t ninputs) int64_t ninputs)
{ {
if (chan_get_type(output) != CHAN_SINGLE) { if (chan_get_type(output) != CHAN_SINGLE) {
err("mux_init: output channel must be of type single\n"); err("output channel must be of type single");
return -1; return -1;
} }
if (select == output) { if (select == output) {
err("mux_init: cannot use same channel as select and output\n"); err("cannot use same channel as select and output");
return -1; return -1;
} }
/* Ensure both channels are registered */ /* Ensure both channels are registered */
if (bay_find(bay, select->name) == NULL) { if (bay_find(bay, select->name) == NULL) {
err("mux_init: select channel %s not registered in bay\n", err("select channel %s not registered in bay", select->name);
select->name);
return -1; return -1;
} }
if (bay_find(bay, output->name) == NULL) { if (bay_find(bay, output->name) == NULL) {
err("mux_init: output channel %s not registered in bay\n", err("output channel %s not registered in bay", output->name);
output->name);
return -1; return -1;
} }
@ -213,12 +211,12 @@ int
mux_set_input(struct mux *mux, int64_t index, struct chan *chan) mux_set_input(struct mux *mux, int64_t index, struct chan *chan)
{ {
if (chan == mux->output) { if (chan == mux->output) {
err("mux_init: cannot use same input channel as output\n"); err("cannot use same input channel as output");
return -1; return -1;
} }
if (chan == mux->select) { if (chan == mux->select) {
err("mux_init: cannot use same input channel as select\n"); err("cannot use same input channel as select");
return -1; return -1;
} }

View File

@ -461,7 +461,7 @@ system_init(struct system *sys, struct emu_args *args, struct trace *trace)
/* Set the offsets of the looms and streams */ /* Set the offsets of the looms and streams */
if (init_offsets(sys, trace) != 0) { if (init_offsets(sys, trace) != 0) {
err("system_init: init_offsets() failed\n"); err("init_offsets() failed");
return -1; return -1;
} }

View File

@ -277,7 +277,7 @@ thread_set_state(struct thread *th, enum thread_state state)
struct chan *st = &th->chan[TH_CHAN_STATE]; struct chan *st = &th->chan[TH_CHAN_STATE];
if (chan_set(st, value_int64(th->state)) != 0) { if (chan_set(st, value_int64(th->state)) != 0) {
err("thread_set_cpu: chan_set() failed"); err("chan_set() failed");
return -1; return -1;
} }

View File

@ -38,7 +38,7 @@ load_stream(struct trace *trace, const char *path)
while (relpath[0] == '/') relpath++; while (relpath[0] == '/') relpath++;
if (stream_load(stream, trace->tracedir, relpath) != 0) { if (stream_load(stream, trace->tracedir, relpath) != 0) {
err("load_stream: emu_steam_load failed\n"); err("emu_steam_load failed");
return -1; return -1;
} }