[MERGED] libosmocore[master]: stats_test: fix mismatching osmo_stats_reporter->send_item s...

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
Sun Jan 15 18:10:17 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: stats_test: fix mismatching osmo_stats_reporter->send_item signature
......................................................................


stats_test: fix mismatching osmo_stats_reporter->send_item signature

The function pointer expects the last arg as int64_t, stats_test.c uses
an int instead. Fix the argument type as well as the printf format for it.

Fixes this compiler warning seen on our FreeBSD build slave:

    CC       stats/stats_test.o
  ../../tests/stats/stats_test.c:288:18: warning: incompatible pointer types assigning to 'int (*)(struct osmo_stats_reporter *, const struct osmo_stat_item_group *, const struct osmo_stat_item_desc *, int64_t)' from 'int (struct osmo_stats_reporter *, const struct osmo_stat_item_group *, const struct osmo_stat_item_desc *, int)' [-Wincompatible-pointer-types]
          srep->send_item = stats_reporter_test_send_item;
                          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 warning generated.

Change-Id: I91cbfd4dd25a881b803943430101dabf07dafc7c
---
M tests/stats/stats_test.c
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/stats/stats_test.c b/tests/stats/stats_test.c
index 75ddf18..0234460 100644
--- a/tests/stats/stats_test.c
+++ b/tests/stats/stats_test.c
@@ -27,6 +27,7 @@
 #include <osmocom/core/stats.h>
 
 #include <stdio.h>
+#include <inttypes.h>
 
 enum test_ctr {
 	TEST_A_CTR,
@@ -251,9 +252,9 @@
 
 static int stats_reporter_test_send_item(struct osmo_stats_reporter *srep,
 	const struct osmo_stat_item_group *statg,
-	const struct osmo_stat_item_desc *desc, int value)
+	const struct osmo_stat_item_desc *desc, int64_t value)
 {
-	printf("  %s: item p=%s g=%s i=%u n=%s v=%d u=%s\n",
+	printf("  %s: item p=%s g=%s i=%u n=%s v=%"PRId64" u=%s\n",
 		srep->name,
 		srep->name_prefix ? srep->name_prefix : "",
 		statg->desc->group_name_prefix, statg->idx,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I91cbfd4dd25a881b803943430101dabf07dafc7c
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list