From 252f590d5c0948ee21f2cb06da4d86d6544dc8cf Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 22 Sep 2013 19:55:31 +0200 Subject: [PATCH] Revert "Check data from getenv("LIBNFC_LOG_LEVEL") and config file" This reverts commit 846189b62c9640c29049c51e56d502131af7f165. It didn't solve Coverity somplain and it broke bitfield support of log_level --- libnfc/conf.c | 5 +---- libnfc/log.c | 5 +---- libnfc/nfc-internal.c | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/libnfc/conf.c b/libnfc/conf.c index 307467f..7bda47d 100644 --- a/libnfc/conf.c +++ b/libnfc/conf.c @@ -125,10 +125,7 @@ conf_keyvalue_context(void *data, const char *key, const char *value) } else if (strcmp(key, "allow_intrusive_scan") == 0) { string_as_boolean(value, &(context->allow_intrusive_scan)); } else if (strcmp(key, "log_level") == 0) { - int i = atoi(value); - if (i < 0) i = 0; - if (i > 3) i = 3; - context->log_level = i; + context->log_level = atoi(value); } else if (strcmp(key, "device.name") == 0) { if ((context->user_defined_device_count == 0) || strcmp(context->user_defined_devices[context->user_defined_device_count - 1].name, "") != 0) { if (context->user_defined_device_count >= MAX_USER_DEFINED_DEVICES) { diff --git a/libnfc/log.c b/libnfc/log.c index 83615b3..0144167 100644 --- a/libnfc/log.c +++ b/libnfc/log.c @@ -87,10 +87,7 @@ log_put(const uint8_t group, const char *category, const uint8_t priority, const log_level = 1; #endif } else { - int i = atoi(env_log_level); - if (i < 0) i = 0; - if (i > 3) i = 3; - log_level = i; + log_level = atoi(env_log_level); } // printf("log_level = %"PRIu32" group = %"PRIu8" priority = %"PRIu8"\n", log_level, group, priority); diff --git a/libnfc/nfc-internal.c b/libnfc/nfc-internal.c index 37512b4..031483e 100644 --- a/libnfc/nfc-internal.c +++ b/libnfc/nfc-internal.c @@ -121,10 +121,7 @@ nfc_context_new(void) // log level envvar = getenv("LIBNFC_LOG_LEVEL"); if (envvar) { - int i = atoi(envvar); - if (i < 0) i = 0; - if (i > 3) i = 3; - res->log_level = i; + res->log_level = atoi(envvar); } #endif // ENVVARS