Remove bay_remove()

This commit is contained in:
Rodrigo Arias 2023-03-21 11:03:58 +01:00 committed by Rodrigo Arias Mallo
parent 5a03fd49e9
commit 9a4a4a0005
2 changed files with 0 additions and 48 deletions

View File

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

View File

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