[library] Check for init/deinit functions in library source
This commit is contained in:
parent
69c3a9c6dc
commit
77086c9b82
|
@ -31,6 +31,7 @@
|
||||||
#ifdef HAVE_PTHREAD_NP_H
|
#ifdef HAVE_PTHREAD_NP_H
|
||||||
# include <pthread_np.h>
|
# include <pthread_np.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unictype.h>
|
#include <unictype.h>
|
||||||
|
@ -795,6 +796,9 @@ library_init(void)
|
||||||
|
|
||||||
for (i = 0; sources[i]; i++)
|
for (i = 0; sources[i]; i++)
|
||||||
{
|
{
|
||||||
|
if (!sources[i]->init)
|
||||||
|
continue;
|
||||||
|
|
||||||
ret = sources[i]->init();
|
ret = sources[i]->init();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
sources[i]->disabled = 1;
|
sources[i]->disabled = 1;
|
||||||
|
@ -844,6 +848,7 @@ library_deinit()
|
||||||
|
|
||||||
for (i = 0; sources[i]; i++)
|
for (i = 0; sources[i]; i++)
|
||||||
{
|
{
|
||||||
|
if (sources[i]->deinit && !sources[i]->disabled)
|
||||||
sources[i]->deinit();
|
sources[i]->deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue