1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Feature: Actually use igloo_initialize() to initialize the library

This commit is contained in:
Philipp Schafft 2018-11-01 11:23:07 +00:00
parent 26221864dd
commit 037776ae55
6 changed files with 10 additions and 14 deletions

View File

@ -47,7 +47,6 @@ extern "C" {
#define IO_BUFFER_TYPE _IOLBF #define IO_BUFFER_TYPE _IOLBF
#endif #endif
void igloo_log_initialize(void);
int igloo_log_open_file(FILE *file); int igloo_log_open_file(FILE *file);
int igloo_log_open(const char *filename); int igloo_log_open(const char *filename);
int igloo_log_open_with_buffer(const char *filename, int size); int igloo_log_open_with_buffer(const char *filename, int size);
@ -60,7 +59,6 @@ int igloo_log_set_archive_timestamp(int id, int value);
void igloo_log_flush(int log_id); void igloo_log_flush(int log_id);
void igloo_log_reopen(int log_id); void igloo_log_reopen(int log_id);
void igloo_log_close(int log_id); void igloo_log_close(int log_id);
void igloo_log_shutdown(void);
void igloo_log_write(int log_id, unsigned priority, const char *cat, const char *func, void igloo_log_write(int log_id, unsigned priority, const char *cat, const char *func,
const char *fmt, ...); const char *fmt, ...);

View File

@ -43,9 +43,6 @@ extern "C" {
** **
*/ */
void igloo_resolver_initialize(void);
void igloo_resolver_shutdown(void);
char *igloo_resolver_getname(const char *ip, char *buff, int len); char *igloo_resolver_getname(const char *ip, char *buff, int len);
char *igloo_resolver_getip(const char *name, char *buff, int len); char *igloo_resolver_getip(const char *name, char *buff, int len);

View File

@ -81,8 +81,6 @@ struct iovec
#define igloo_sock_connect(h, p) igloo_sock_connect_wto(h, p, 0) #define igloo_sock_connect(h, p) igloo_sock_connect_wto(h, p, 0)
/* Misc socket functions */ /* Misc socket functions */
void igloo_sock_initialize(void);
void igloo_sock_shutdown(void);
char *igloo_sock_get_localip(char *buff, int len); char *igloo_sock_get_localip(char *buff, int len);
int igloo_sock_error(void); int igloo_sock_error(void);
int igloo_sock_recoverable(int error); int igloo_sock_recoverable(int error);

View File

@ -140,11 +140,6 @@ typedef igloo_mutex_t igloo_spin_t;
#define igloo_THREAD_DETACHED 1 #define igloo_THREAD_DETACHED 1
#define igloo_THREAD_ATTACHED 0 #define igloo_THREAD_ATTACHED 0
/* init/shutdown of the library */
void igloo_thread_initialize(void);
void igloo_thread_initialize_with_log_id(int log_id);
void igloo_thread_shutdown(void);
/* creation, destruction, locking, unlocking, signalling and waiting */ /* creation, destruction, locking, unlocking, signalling and waiting */
igloo_thread_type *igloo_thread_create_c(char *name, void *(*start_routine)(void *), igloo_thread_type *igloo_thread_create_c(char *name, void *(*start_routine)(void *),
void *arg, int detached, int line, char *file); void *arg, int detached, int line, char *file);

View File

@ -58,6 +58,7 @@
#include <igloo/sock.h> #include <igloo/sock.h>
#include <igloo/resolver.h> #include <igloo/resolver.h>
#include "../src/private.h"
/* for older C libraries */ /* for older C libraries */
#ifndef AI_NUMERICSERV #ifndef AI_NUMERICSERV

View File

@ -28,6 +28,7 @@ typedef struct igloo_instance_tag igloo_instance_t;
#define igloo_RO_PRIVATETYPES igloo_RO_TYPE(igloo_instance_t) #define igloo_RO_PRIVATETYPES igloo_RO_TYPE(igloo_instance_t)
#include "../include/igloo/ro.h" #include "../include/igloo/ro.h"
#include "private.h"
struct igloo_instance_tag { struct igloo_instance_tag {
igloo_ro_base_t __base; igloo_ro_base_t __base;
@ -41,7 +42,10 @@ static void igloo_initialize__free(igloo_ro_t self)
if (igloo_initialize__refc) if (igloo_initialize__refc)
return; return;
/* TODO: Add any uninit code here. */ igloo_resolver_shutdown();
igloo_sock_shutdown();
igloo_thread_shutdown();
igloo_log_shutdown();
} }
igloo_RO_PRIVATE_TYPE(igloo_instance_t, igloo_RO_PRIVATE_TYPE(igloo_instance_t,
@ -54,7 +58,10 @@ igloo_ro_t igloo_initialize(void)
char name[128]; char name[128];
if (!igloo_initialize__refc) { if (!igloo_initialize__refc) {
/* TODO: Add any init code here. */ igloo_log_initialize();
igloo_thread_initialize();
igloo_sock_initialize();
igloo_resolver_initialize();
} }
snprintf(name, sizeof(name), "<libigloo instance %zu>", igloo_initialize__refc); snprintf(name, sizeof(name), "<libigloo instance %zu>", igloo_initialize__refc);