1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

remove PLUGIN_REGISTER() macro

This commit is contained in:
Steffen Vogel 2019-04-23 13:04:30 +02:00
parent 8f974511fe
commit a97c4b8078
2 changed files with 1 additions and 25 deletions

View file

@ -28,28 +28,6 @@
#include <villas/node_type.h>
#include <villas/format_type.h>
/** (De-)Register a plugin by adding it to the global plugin list.
*
* We make use of GCC's / Clang's constructor/destructor function
* attributes to let the following code be executed by the loader.
* This works only when we compile libvillas as a shared library!
*
* The __attribute__((constructor)) / __attribute__((destructor))
* is currently only supported by GCC and Clang
*
* See: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
*/
#define REGISTER_PLUGIN(p) \
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {\
if (plugins.state == STATE_DESTROYED) \
vlist_init(&plugins); \
vlist_push(&plugins, p); \
} \
__attribute__((destructor(110))) static void UNIQUE(__dtor)() { \
if (plugins.state != STATE_DESTROYED) \
vlist_remove_all(&plugins, p); \
}
extern struct vlist plugins;
enum plugin_type {

View file

@ -132,7 +132,7 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
p1.format.size = 0;
p1.format.flags = IO_HAS_BINARY_PAYLOAD |
SAMPLE_HAS_TS_ORIGIN | SAMPLE_HAS_SEQUENCE | SAMPLE_HAS_DATA;
vlist_push(&plugins, &p1);
}
@ -164,5 +164,3 @@ __attribute__((destructor(110))) static void UNIQUE(__dtor)() {
if (plugins.state != STATE_DESTROYED)
vlist_remove_all(&plugins, &p2);
}
REGISTER_PLUGIN(&p1);
REGISTER_PLUGIN(&p2);