Change in libosmocore[master]: logging: refactor and simplify log_target_destroy()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Wed Sep 9 11:40:45 UTC 2020


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20042 )

Change subject: logging: refactor and simplify log_target_destroy()
......................................................................

logging: refactor and simplify log_target_destroy()

Change-Id: Ic6b9906e6fd24de6af9c869348c100d9ef6a7df6
---
M src/logging.c
1 file changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



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
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20042
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic6b9906e6fd24de6af9c869348c100d9ef6a7df6
Gerrit-Change-Number: 20042
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200909/17e03e85/attachment.htm>


More information about the gerrit-log mailing list