[PATCH] osmocom-bb[master]: host/trxcon: use LOGP instead of fprintf

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:33:24 UTC 2018


Review at  https://gerrit.osmocom.org/6781

host/trxcon: use LOGP instead of fprintf

There is no (performance) reason to use fprintf instead of LOGP.
Second one provides more useful information, such as a file name
and a line number.

Change-Id: I86dda5b3d746c7802442e4226578a06c04941721
---
M src/host/trxcon/l1ctl_link.c
M src/host/trxcon/trx_if.c
2 files changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/81/6781/1

diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c
index c38a871..3bbdf34 100644
--- a/src/host/trxcon/l1ctl_link.c
+++ b/src/host/trxcon/l1ctl_link.c
@@ -74,7 +74,7 @@
 	msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM,
 		L1CTL_HEADROOM, "L1CTL");
 	if (!msg) {
-		fprintf(stderr, "Failed to allocate msg\n");
+		LOGP(DL1D, LOGL_ERROR, "Failed to allocate msg\n");
 		return -ENOMEM;
 	}
 
@@ -236,7 +236,7 @@
 
 	l1l_new = talloc_zero(tall_trx_ctx, struct l1ctl_link);
 	if (!l1l_new) {
-		fprintf(stderr, "Failed to allocate memory\n");
+		LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n");
 		return -ENOMEM;
 	}
 
@@ -245,7 +245,7 @@
 	rc = osmo_sock_unix_init_ofd(bfd, SOCK_STREAM, 0, sock_path,
 		OSMO_SOCK_F_BIND);
 	if (rc < 0) {
-		fprintf(stderr, "Could not create UNIX socket: %s\n",
+		LOGP(DL1C, LOGL_ERROR, "Could not create UNIX socket: %s\n",
 			strerror(errno));
 		talloc_free(l1l_new);
 		return rc;
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 5820d70..368c474 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -636,7 +636,7 @@
 	/* Try to allocate memory */
 	trx_new = talloc_zero(tall_trx_ctx, struct trx_instance);
 	if (!trx_new) {
-		fprintf(stderr, "Failed to allocate memory\n");
+		LOGP(DTRX, LOGL_ERROR, "Failed to allocate memory\n");
 		return -ENOMEM;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/6781
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86dda5b3d746c7802442e4226578a06c04941721
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list