From 7ec1fb78baaa3d4bd7b36cc042248e24d5f481fe Mon Sep 17 00:00:00 2001 From: Slyshyk Oleksiy Date: Wed, 28 Mar 2018 11:03:38 +0300 Subject: [PATCH] remove exit() from lib. fix #634 (#696) * remove exit() from lib. fix #634 * remove the UFATAL loglevel completely. --- include/stlink/logging.h | 11 ++++------- src/logging.c | 6 ------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/include/stlink/logging.h b/include/stlink/logging.h index a6632a7..16ed948 100644 --- a/include/stlink/logging.h +++ b/include/stlink/logging.h @@ -10,11 +10,10 @@ extern "C" { #endif enum ugly_loglevel { - UDEBUG = 90, - UINFO = 50, - UWARN = 30, - UERROR = 20, - UFATAL = 10 + UDEBUG = 90, + UINFO = 50, + UWARN = 30, + UERROR = 20 }; int ugly_init(int maximum_threshold); @@ -33,8 +32,6 @@ int ugly_log(int level, const char *tag, const char *format, ...); #define WLOG(...) WLOG_HELPER(__VA_ARGS__, "") #define ELOG_HELPER(format, ...) ugly_log(UERROR, UGLY_LOG_FILE, format, __VA_ARGS__) #define ELOG(...) ELOG_HELPER(__VA_ARGS__, "") -#define fatal_helper(format, ...) ugly_log(UFATAL, UGLY_LOG_FILE, format, __VA_ARGS__) -#define fatal(...) fatal_helper(__VA_ARGS__, "") #ifdef __cplusplus } diff --git a/src/logging.c b/src/logging.c index 1f51900..b5e423a 100644 --- a/src/logging.c +++ b/src/logging.c @@ -41,12 +41,6 @@ int ugly_log(int level, const char *tag, const char *format, ...) { case UERROR: fprintf(stderr, "ERROR %s: ", tag); break; - case UFATAL: - fprintf(stderr, "FATAL %s: ", tag); - vfprintf(stderr, format, args); - exit(EXIT_FAILURE); - // NEVER GETS HERE!!! - break; default: fprintf(stderr, "%d %s: ", level, tag); break;