Commit eae02ed1 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

add vlist_init_and_push()

parent b3122d5d
......@@ -153,4 +153,6 @@ ssize_t vlist_lookup_index(struct vlist *l, const std::string &name)
auto *f = vlist_lookup_name<T>(l, name);
return f ? vlist_index(l, f) : -1;
}
\ No newline at end of file
}
int vlist_init_and_push(struct vlist *l, void *p);
\ No newline at end of file
......@@ -287,3 +287,18 @@ void vlist_filter(struct vlist *l, dtor_cb_t cb)
pthread_mutex_unlock(&l->lock);
}
int vlist_init_and_push(struct vlist *l, void *p)
{
int ret;
if (l->state == State::DESTROYED) {
ret = vlist_init(l);
if (ret)
return ret;
}
vlist_push(l, p);
return 0;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment