Removes exit() calls
Fixes issue 220 exit() was used to run abort-driven development while API changed, I forgot to remove them, sorry for that :-)
This commit is contained in:
parent
3d580dc3ec
commit
4b97700352
1 changed files with 4 additions and 11 deletions
15
libnfc/nfc.c
15
libnfc/nfc.c
|
@ -114,10 +114,6 @@ const struct nfc_driver *nfc_drivers[] = {
|
||||||
void
|
void
|
||||||
nfc_init(nfc_context **context)
|
nfc_init(nfc_context **context)
|
||||||
{
|
{
|
||||||
if (!context) {
|
|
||||||
printf("Error: NULL context is not supported anymore, please fix your code.\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
*context = nfc_context_new();
|
*context = nfc_context_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,11 +232,6 @@ nfc_list_devices(nfc_context *context, nfc_connstring connstrings[], const size_
|
||||||
const struct nfc_driver *ndr;
|
const struct nfc_driver *ndr;
|
||||||
const struct nfc_driver **pndr = nfc_drivers;
|
const struct nfc_driver **pndr = nfc_drivers;
|
||||||
|
|
||||||
if (!context) {
|
|
||||||
printf("NULL context is not supported anymore! Please fix your code.\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load manually configured devices (from config file and env variables)
|
// Load manually configured devices (from config file and env variables)
|
||||||
// TODO From env var...
|
// TODO From env var...
|
||||||
for (uint32_t i = 0; i < context->user_defined_device_count; i++) {
|
for (uint32_t i = 0; i < context->user_defined_device_count; i++) {
|
||||||
|
@ -251,8 +242,10 @@ nfc_list_devices(nfc_context *context, nfc_connstring connstrings[], const size_
|
||||||
char *old_env_log_level = NULL;
|
char *old_env_log_level = NULL;
|
||||||
// do it silently
|
// do it silently
|
||||||
if (env_log_level) {
|
if (env_log_level) {
|
||||||
if ((old_env_log_level = malloc(strlen(env_log_level) + 1)) == NULL)
|
if ((old_env_log_level = malloc(strlen(env_log_level) + 1)) == NULL) {
|
||||||
exit(EXIT_FAILURE);
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to malloc()");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
strcpy(old_env_log_level, env_log_level);
|
strcpy(old_env_log_level, env_log_level);
|
||||||
}
|
}
|
||||||
setenv("LIBNFC_LOG_LEVEL", "0", 1);
|
setenv("LIBNFC_LOG_LEVEL", "0", 1);
|
||||||
|
|
Loading…
Reference in a new issue