From 5a03fd49e97ff6238050e250d8852f40f9518de4 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 21 Mar 2023 11:01:54 +0100 Subject: [PATCH] Remove function prefix from err() --- src/emu/bay.c | 19 ++++++++----------- src/emu/clkoff.c | 4 ++-- src/emu/mux.c | 20 +++++++++----------- src/emu/system.c | 2 +- src/emu/thread.c | 2 +- src/emu/trace.c | 2 +- 6 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/emu/bay.c b/src/emu/bay.c index 4038442..37a5c62 100644 --- a/src/emu/bay.c +++ b/src/emu/bay.c @@ -59,14 +59,13 @@ bay_register(struct bay *bay, struct chan *chan) { struct bay_chan *bchan = find_bay_chan(bay, chan->name); if (bchan != NULL) { - err("bay_register: channel %s already registered\n", - chan->name); + err("channel %s already registered", chan->name); return -1; } bchan = calloc(1, sizeof(struct bay_chan)); if (bchan == NULL) { - err("bay_register: calloc failed\n"); + err("calloc failed:"); return -1; } @@ -87,14 +86,12 @@ bay_remove(struct bay *bay, struct chan *chan) { struct bay_chan *bchan = find_bay_chan(bay, chan->name); if (bchan == NULL) { - err("bay_remove: channel %s not registered\n", - chan->name); + err("channel %s not registered", chan->name); return -1; } if (bchan->is_dirty) { - err("bay_remove: cannot remote bay channel %s in dirty state\n", - chan->name); + err("cannot remote bay channel %s in dirty state", chan->name); return -1; } @@ -195,7 +192,7 @@ propagate_chan(struct bay_chan *bchan, enum bay_cb_type type) DL_FOREACH(bchan->cb[type], cur) { dbg("calling cb %p", cur->func); if (cur->func(bchan->chan, cur->arg) != 0) { - err("propagate_chan: callback failed\n"); + err("callback failed"); return -1; } } @@ -211,7 +208,7 @@ bay_propagate(struct bay *bay) DL_FOREACH(bay->dirty, cur) { /* May add more dirty channels */ if (propagate_chan(cur, BAY_CB_DIRTY) != 0) { - err("bay_propagate: propagate_chan failed\n"); + err("propagate_chan failed"); return -1; } } @@ -224,7 +221,7 @@ bay_propagate(struct bay *bay) DL_FOREACH(bay->dirty, cur) { /* Cannot add more dirty channels */ if (propagate_chan(cur, BAY_CB_EMIT) != 0) { - err("bay_propagate: propagate_chan failed\n"); + err("propagate_chan failed"); return -1; } } @@ -237,7 +234,7 @@ bay_propagate(struct bay *bay) bay->state = BAY_FLUSHING; DL_FOREACH(bay->dirty, cur) { if (chan_flush(cur->chan) != 0) { - err("bay_propagate: chan_flush failed\n"); + err("chan_flush failed"); return -1; } cur->is_dirty = 0; diff --git a/src/emu/clkoff.c b/src/emu/clkoff.c index 3fbe47e..640dfee 100644 --- a/src/emu/clkoff.c +++ b/src/emu/clkoff.c @@ -119,13 +119,13 @@ int clkoff_load(struct clkoff *table, FILE *file) { if (cparse(table, file) != 0) { - err("clkoff_load: failed parsing clock table\n"); + err("failed parsing clock table"); return -1; } /* Create index array */ if (cindex(table) != 0) { - err("clkoff_load: failed indexing table\n"); + err("failed indexing table"); return -1; } diff --git a/src/emu/mux.c b/src/emu/mux.c index fc7ea8d..dd89342 100644 --- a/src/emu/mux.c +++ b/src/emu/mux.c @@ -62,7 +62,7 @@ cb_select(struct chan *sel_chan, void *ptr) struct value sel_value; if (chan_read(sel_chan, &sel_value) != 0) { - err("cb_select: chan_read(select) failed\n"); + err("chan_read(select) failed"); return -1; } @@ -96,12 +96,12 @@ cb_select(struct chan *sel_chan, void *ptr) /* Set to null by default */ struct value out_value = value_null(); if (input != NULL && chan_read(input->chan, &out_value) != 0) { - err("cb_select: chan_read() failed\n"); + err("chan_read() failed"); return -1; } if (chan_set(mux->output, out_value) != 0) { - err("cb_select: chan_set() failed\n"); + err("chan_set() failed"); return -1; } @@ -143,24 +143,22 @@ mux_init(struct mux *mux, int64_t ninputs) { 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; } 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; } /* Ensure both channels are registered */ if (bay_find(bay, select->name) == NULL) { - err("mux_init: select channel %s not registered in bay\n", - select->name); + err("select channel %s not registered in bay", select->name); return -1; } if (bay_find(bay, output->name) == NULL) { - err("mux_init: output channel %s not registered in bay\n", - output->name); + err("output channel %s not registered in bay", output->name); return -1; } @@ -213,12 +211,12 @@ int mux_set_input(struct mux *mux, int64_t index, struct chan *chan) { 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; } 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; } diff --git a/src/emu/system.c b/src/emu/system.c index 63c3cfa..252d6fc 100644 --- a/src/emu/system.c +++ b/src/emu/system.c @@ -461,7 +461,7 @@ system_init(struct system *sys, struct emu_args *args, struct trace *trace) /* Set the offsets of the looms and streams */ if (init_offsets(sys, trace) != 0) { - err("system_init: init_offsets() failed\n"); + err("init_offsets() failed"); return -1; } diff --git a/src/emu/thread.c b/src/emu/thread.c index f74a341..07e5ecd 100644 --- a/src/emu/thread.c +++ b/src/emu/thread.c @@ -277,7 +277,7 @@ thread_set_state(struct thread *th, enum thread_state state) struct chan *st = &th->chan[TH_CHAN_STATE]; if (chan_set(st, value_int64(th->state)) != 0) { - err("thread_set_cpu: chan_set() failed"); + err("chan_set() failed"); return -1; } diff --git a/src/emu/trace.c b/src/emu/trace.c index 7c85834..50fbeac 100644 --- a/src/emu/trace.c +++ b/src/emu/trace.c @@ -38,7 +38,7 @@ load_stream(struct trace *trace, const char *path) while (relpath[0] == '/') relpath++; if (stream_load(stream, trace->tracedir, relpath) != 0) { - err("load_stream: emu_steam_load failed\n"); + err("emu_steam_load failed"); return -1; }