diff options
author | David Robillard <d@drobilla.net> | 2020-12-26 19:21:17 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-26 19:21:17 +0100 |
commit | 882b9446cbf7316345de391188e68c2a7333da5b (patch) | |
tree | 5baf31e0a28313b380cc7e8694b09a2a517d14f3 /lv2/log/logger.h | |
parent | 8d2251749da9e0ae4254502edfc8917236a9b8c0 (diff) | |
download | lv2-882b9446cbf7316345de391188e68c2a7333da5b.tar.xz |
Format all code with clang-format
Diffstat (limited to 'lv2/log/logger.h')
-rw-r--r-- | lv2/log/logger.h | 84 |
1 files changed, 41 insertions, 43 deletions
diff --git a/lv2/log/logger.h b/lv2/log/logger.h index 669069c..80459a7 100644 --- a/lv2/log/logger.h +++ b/lv2/log/logger.h @@ -42,12 +42,12 @@ extern "C" { Logger convenience API state. */ typedef struct { - LV2_Log_Log* log; + LV2_Log_Log* log; - LV2_URID Error; - LV2_URID Note; - LV2_URID Trace; - LV2_URID Warning; + LV2_URID Error; + LV2_URID Note; + LV2_URID Trace; + LV2_URID Warning; } LV2_Log_Logger; /** @@ -59,14 +59,14 @@ typedef struct { static inline void lv2_log_logger_set_map(LV2_Log_Logger* logger, LV2_URID_Map* map) { - if (map) { - logger->Error = map->map(map->handle, LV2_LOG__Error); - logger->Note = map->map(map->handle, LV2_LOG__Note); - logger->Trace = map->map(map->handle, LV2_LOG__Trace); - logger->Warning = map->map(map->handle, LV2_LOG__Warning); - } else { - logger->Error = logger->Note = logger->Trace = logger->Warning = 0; - } + if (map) { + logger->Error = map->map(map->handle, LV2_LOG__Error); + logger->Note = map->map(map->handle, LV2_LOG__Note); + logger->Trace = map->map(map->handle, LV2_LOG__Trace); + logger->Warning = map->map(map->handle, LV2_LOG__Warning); + } else { + logger->Error = logger->Note = logger->Trace = logger->Warning = 0; + } } /** @@ -77,12 +77,10 @@ lv2_log_logger_set_map(LV2_Log_Logger* logger, LV2_URID_Map* map) in which case the implementation will fall back to printing to stderr. */ static inline void -lv2_log_logger_init(LV2_Log_Logger* logger, - LV2_URID_Map* map, - LV2_Log_Log* log) +lv2_log_logger_init(LV2_Log_Logger* logger, LV2_URID_Map* map, LV2_Log_Log* log) { - logger->log = log; - lv2_log_logger_set_map(logger, map); + logger->log = log; + lv2_log_logger_set_map(logger, map); } /** @@ -95,9 +93,9 @@ lv2_log_vprintf(LV2_Log_Logger* logger, const char* fmt, va_list args) { - return ((logger && logger->log) - ? logger->log->vprintf(logger->log->handle, type, fmt, args) - : vfprintf(stderr, fmt, args)); + return ((logger && logger->log) + ? logger->log->vprintf(logger->log->handle, type, fmt, args) + : vfprintf(stderr, fmt, args)); } /** Log an error via lv2_log_vprintf(). */ @@ -105,11 +103,11 @@ LV2_LOG_FUNC(2, 3) static inline int lv2_log_error(LV2_Log_Logger* logger, const char* fmt, ...) { - va_list args; - va_start(args, fmt); - const int ret = lv2_log_vprintf(logger, logger->Error, fmt, args); - va_end(args); - return ret; + va_list args; + va_start(args, fmt); + const int ret = lv2_log_vprintf(logger, logger->Error, fmt, args); + va_end(args); + return ret; } /** Log a note via lv2_log_vprintf(). */ @@ -117,11 +115,11 @@ LV2_LOG_FUNC(2, 3) static inline int lv2_log_note(LV2_Log_Logger* logger, const char* fmt, ...) { - va_list args; - va_start(args, fmt); - const int ret = lv2_log_vprintf(logger, logger->Note, fmt, args); - va_end(args); - return ret; + va_list args; + va_start(args, fmt); + const int ret = lv2_log_vprintf(logger, logger->Note, fmt, args); + va_end(args); + return ret; } /** Log a trace via lv2_log_vprintf(). */ @@ -129,11 +127,11 @@ LV2_LOG_FUNC(2, 3) static inline int lv2_log_trace(LV2_Log_Logger* logger, const char* fmt, ...) { - va_list args; - va_start(args, fmt); - const int ret = lv2_log_vprintf(logger, logger->Trace, fmt, args); - va_end(args); - return ret; + va_list args; + va_start(args, fmt); + const int ret = lv2_log_vprintf(logger, logger->Trace, fmt, args); + va_end(args); + return ret; } /** Log a warning via lv2_log_vprintf(). */ @@ -141,19 +139,19 @@ LV2_LOG_FUNC(2, 3) static inline int lv2_log_warning(LV2_Log_Logger* logger, const char* fmt, ...) { - va_list args; - va_start(args, fmt); - const int ret = lv2_log_vprintf(logger, logger->Warning, fmt, args); - va_end(args); - return ret; + va_list args; + va_start(args, fmt); + const int ret = lv2_log_vprintf(logger, logger->Warning, fmt, args); + va_end(args); + return ret; } #ifdef __cplusplus -} /* extern "C" */ +} /* extern "C" */ #endif /** @} */ -#endif /* LV2_LOG_LOGGER_H */ +#endif /* LV2_LOG_LOGGER_H */ |