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