[PATCH] libosmo-netif[master]: osmux: Slightly improve output format of osmux_snprintf

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Aug 14 17:13:12 UTC 2017


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

osmux: Slightly improve output format of osmux_snprintf

The buffer for osmux_test is increased as the former doesn't seem to be
able to cope with the whole output.

Change-Id: Ic838dd9d7ad89b4510ccfa58c0390c69a075b616
---
M src/osmux.c
M tests/osmux/osmux_test.c
2 files changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/22/3522/1

diff --git a/src/osmux.c b/src/osmux.c
index 2481d6a..b3c43e2 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -877,12 +877,15 @@
 	int ret, i;
 	int len = size, offset = 0;
 
+	ret = snprintf(buf+offset, len, "[ ");
+	SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+
 	for (i=0; i<payload_len; i++) {
 		ret = snprintf(buf+offset, len, "%02x ", payload[i]);
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 	}
 
-	ret = snprintf(buf+offset, len, "]");
+	ret = snprintf(buf+offset, len, "] ");
 	SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
 	return offset;
diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c
index 63f89f1..bf6174b 100644
--- a/tests/osmux/osmux_test.c
+++ b/tests/osmux/osmux_test.c
@@ -102,7 +102,7 @@
 
 static void osmux_deliver(struct msgb *batch_msg, void *data)
 {
-	char buf[1024];
+	char buf[2048];
 	struct osmux_hdr *osmuxh;
 	LLIST_HEAD(list);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic838dd9d7ad89b4510ccfa58c0390c69a075b616
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list