diff --git a/core/od.h b/core/od.h index 3f84ea71..846c9f60 100644 --- a/core/od.h +++ b/core/od.h @@ -10,11 +10,11 @@ typedef struct od_t od_t; struct od_t { - od_pid_t pid; - odsyslog_t syslog; - odlog_t log; - odconfig_t config; - odscheme_t scheme; + od_pid_t pid; + od_syslog_t syslog; + odlog_t log; + odconfig_t config; + odscheme_t scheme; }; void od_init(od_t*); diff --git a/core/od_log.c b/core/od_log.c index 7f46739b..1c094b42 100644 --- a/core/od_log.c +++ b/core/od_log.c @@ -23,7 +23,7 @@ #include "od_syslog.h" #include "od_log.h" -int od_loginit(odlog_t *l, od_pid_t *pid, odsyslog_t *syslog) +int od_loginit(odlog_t *l, od_pid_t *pid, od_syslog_t *syslog) { l->pid = pid; l->syslog = syslog; @@ -49,7 +49,7 @@ int od_logclose(odlog_t *l) return rc; } -int od_logv(odlog_t *l, odsyslog_prio_t prio, +int od_logv(odlog_t *l, od_syslogprio_t prio, char *ident, char *fmt, va_list args) { diff --git a/core/od_log.h b/core/od_log.h index 551f3654..a18751f5 100644 --- a/core/od_log.h +++ b/core/od_log.h @@ -11,14 +11,14 @@ typedef struct odlog_t odlog_t; struct odlog_t { od_pid_t *pid; - odsyslog_t *syslog; + od_syslog_t *syslog; int fd; }; -int od_loginit(odlog_t*, od_pid_t*, odsyslog_t*); +int od_loginit(odlog_t*, od_pid_t*, od_syslog_t*); int od_logopen(odlog_t*, char*); int od_logclose(odlog_t*); -int od_logv(odlog_t*, odsyslog_prio_t, char*, char*, va_list); +int od_logv(odlog_t*, od_syslogprio_t, char*, char*, va_list); static inline int od_log(odlog_t *l, char *fmt, ...) diff --git a/core/od_syslog.c b/core/od_syslog.c index 0e56e16c..61fbe63b 100644 --- a/core/od_syslog.c +++ b/core/od_syslog.c @@ -23,14 +23,14 @@ #include "od_macro.h" #include "od_syslog.h" -typedef struct odsyslog_facility_t odsyslog_facility_t; +typedef struct od_syslog_facility_t od_syslog_facility_t; -struct odsyslog_facility_t { +struct od_syslog_facility_t { char *name; int id; }; -odsyslog_facility_t od_syslog_facilities[] = +od_syslog_facility_t od_syslog_facilities[] = { { "daemon", LOG_DAEMON }, { "user", LOG_USER }, @@ -49,12 +49,12 @@ static int od_syslog_prio[] = { LOG_INFO, LOG_ERR, LOG_DEBUG }; -int od_syslog_open(odsyslog_t *slog, char *ident, char *facility) +int od_syslog_open(od_syslog_t *slog, char *ident, char *facility) { int facility_id = LOG_DAEMON; if (facility) { int i = 0; - odsyslog_facility_t *facility_ptr; + od_syslog_facility_t *facility_ptr; for (;;) { facility_ptr = &od_syslog_facilities[i]; if (facility_ptr->name == NULL) @@ -73,14 +73,14 @@ int od_syslog_open(odsyslog_t *slog, char *ident, char *facility) return 0; } -void od_syslog_close(odsyslog_t *slog) +void od_syslog_close(od_syslog_t *slog) { if (! slog->in_use) return; closelog(); } -void od_syslog(odsyslog_t *slog, odsyslog_prio_t prio, char *msg) +void od_syslog(od_syslog_t *slog, od_syslogprio_t prio, char *msg) { if (slog->in_use) syslog(od_syslog_prio[prio], "%s", msg); diff --git a/core/od_syslog.h b/core/od_syslog.h index b678a4c5..0460b5bd 100644 --- a/core/od_syslog.h +++ b/core/od_syslog.h @@ -7,25 +7,25 @@ * PostgreSQL connection pooler and request router. */ -typedef struct odsyslog_t odsyslog_t; +typedef struct od_syslog_t od_syslog_t; typedef enum { OD_SYSLOG_INFO, OD_SYSLOG_ERROR, OD_SYSLOG_DEBUG -} odsyslog_prio_t; +} od_syslogprio_t; -struct odsyslog_t { +struct od_syslog_t { int in_use; }; static inline void -od_syslog_init(odsyslog_t *syslog) { +od_syslog_init(od_syslog_t *syslog) { syslog->in_use = 0; } -int od_syslog_open(odsyslog_t*, char*, char*); -void od_syslog_close(odsyslog_t*); -void od_syslog(odsyslog_t*, odsyslog_prio_t, char*); +int od_syslog_open(od_syslog_t*, char*, char*); +void od_syslog_close(od_syslog_t*); +void od_syslog(od_syslog_t*, od_syslogprio_t, char*); #endif