mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
list: do not check state during intialization
This commit is contained in:
parent
dba74c9ec9
commit
6ff09880c7
3 changed files with 1 additions and 8 deletions
|
@ -38,8 +38,7 @@
|
|||
/** Static list initialization */
|
||||
#define LIST_INIT_STATIC(l) \
|
||||
__attribute__((constructor(105))) static void UNIQUE(__ctor)() {\
|
||||
if ((l)->state == State::DESTROYED) \
|
||||
vlist_init(l); \
|
||||
vlist_init(l); \
|
||||
} \
|
||||
__attribute__((destructor(105))) static void UNIQUE(__dtor)() { \
|
||||
vlist_destroy(l, nullptr, false); \
|
||||
|
|
|
@ -55,8 +55,6 @@ static int cmp_sort(const void *a, const void *b, void *thunk) {
|
|||
|
||||
int vlist_init(struct vlist *l)
|
||||
{
|
||||
assert(l->state == State::DESTROYED);
|
||||
|
||||
pthread_mutex_init(&l->lock, nullptr);
|
||||
|
||||
l->length = 0;
|
||||
|
|
|
@ -42,7 +42,6 @@ TestSuite(list, .description = "List datastructure");
|
|||
Test(list, vlist_lookup)
|
||||
{
|
||||
struct vlist l;
|
||||
l.state = State::DESTROYED;
|
||||
|
||||
vlist_init(&l);
|
||||
|
||||
|
@ -67,7 +66,6 @@ Test(list, vlist_lookup)
|
|||
Test(list, vlist_search)
|
||||
{
|
||||
struct vlist l;
|
||||
l.state = State::DESTROYED;
|
||||
|
||||
vlist_init(&l);
|
||||
|
||||
|
@ -108,7 +106,6 @@ static int dtor(void *ptr)
|
|||
Test(list, destructor)
|
||||
{
|
||||
struct vlist l;
|
||||
l.state = State::DESTROYED;
|
||||
|
||||
struct content elm;
|
||||
elm.destroyed = 0;
|
||||
|
@ -128,7 +125,6 @@ Test(list, basics)
|
|||
uintptr_t i;
|
||||
int ret;
|
||||
struct vlist l;
|
||||
l.state = State::DESTROYED;
|
||||
|
||||
vlist_init(&l);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue