logging: refactor and simplify log_target_destroy()
Change-Id: Ic6b9906e6fd24de6af9c869348c100d9ef6a7df6
diff --git a/src/logging.c b/src/logging.c
index c14e696..78abc19 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -959,16 +959,14 @@
log_del_target(target);
#if (!EMBEDDED)
- if (target->output == &_file_output) {
-/* since C89/C99 says stderr is a macro, we can safely do this! */
-#ifdef stderr
- /* don't close stderr */
- if (target->tgt_file.out != stderr)
-#endif
- {
- fclose(target->tgt_file.out);
- target->tgt_file.out = NULL;
- }
+ switch (target->type) {
+ case LOG_TGT_TYPE_FILE:
+ fclose(target->tgt_file.out);
+ target->tgt_file.out = NULL;
+ break;
+ default:
+ /* make GCC happy */
+ break;
}
#endif