From 9a4a4a0005d5ccd512c2586ad64caec2af9fb93b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 21 Mar 2023 11:03:58 +0100 Subject: [PATCH] Remove bay_remove() --- src/emu/bay.c | 22 ---------------------- test/unit/bay.c | 26 -------------------------- 2 files changed, 48 deletions(-) diff --git a/src/emu/bay.c b/src/emu/bay.c index 37a5c62..26348f5 100644 --- a/src/emu/bay.c +++ b/src/emu/bay.c @@ -81,28 +81,6 @@ bay_register(struct bay *bay, struct chan *chan) return 0; } -int -bay_remove(struct bay *bay, struct chan *chan) -{ - struct bay_chan *bchan = find_bay_chan(bay, chan->name); - if (bchan == NULL) { - err("channel %s not registered", chan->name); - return -1; - } - - if (bchan->is_dirty) { - err("cannot remote bay channel %s in dirty state", chan->name); - return -1; - } - - chan_set_dirty_cb(chan, NULL, NULL); - - HASH_DEL(bay->channels, bchan); - free(bchan); - - return 0; -} - struct bay_cb * bay_add_cb(struct bay *bay, enum bay_cb_type type, struct chan *chan, bay_cb_func_t func, void *arg, int enabled) diff --git a/test/unit/bay.c b/test/unit/bay.c index 9dd6755..2e2f528 100644 --- a/test/unit/bay.c +++ b/test/unit/bay.c @@ -4,25 +4,6 @@ #include "emu/bay.h" #include "common.h" -static void -test_remove(struct bay *bay) -{ - struct chan chan; - chan_init(&chan, CHAN_SINGLE, "removeme"); - - if (bay_register(bay, &chan) != 0) - die("bay_register failed\n"); - - if (bay_find(bay, chan.name) == NULL) - die("bay_find failed\n"); - - if (bay_remove(bay, &chan) != 0) - die("bay_remove failed\n"); - - if (bay_find(bay, chan.name) != NULL) - die("bay_find didn't fail\n"); -} - static void test_duplicate(struct bay *bay) { @@ -34,9 +15,6 @@ test_duplicate(struct bay *bay) if (bay_register(bay, &chan) == 0) die("bay_register didn't fail\n"); - - if (bay_remove(bay, &chan) != 0) - die("bay_remove failed\n"); } static int @@ -83,9 +61,6 @@ test_callback(struct bay *bay) if (data != 1) die("data didn't change after bay_propagate\n"); - - if (bay_remove(bay, &chan) != 0) - die("bay_remove failed\n"); } int main(void) @@ -93,7 +68,6 @@ int main(void) struct bay bay; bay_init(&bay); - test_remove(&bay); test_duplicate(&bay); test_callback(&bay);