[PATCH] libosmocore[master]: rate_ctr: Add rate_ctr_inc2() as convenience wrapper

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
Sat Feb 24 13:47:00 UTC 2018


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

rate_ctr: Add rate_ctr_inc2() as convenience wrapper

rate_ctr_inc2() is slightly easier to use than the old
rate_ctr_inc() variant.

Change-Id: Ie00706be201c32ec2981ea38b70354ed85e1aefd
---
M include/osmocom/core/rate_ctr.h
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/6878/1

diff --git a/include/osmocom/core/rate_ctr.h b/include/osmocom/core/rate_ctr.h
index 6ce2dfe..865467c 100644
--- a/include/osmocom/core/rate_ctr.h
+++ b/include/osmocom/core/rate_ctr.h
@@ -88,6 +88,15 @@
 	rate_ctr_add(ctr, 1);
 }
 
+/*! Increment the counter by 1
+ *  \param ctrg \ref rate_ctr_group of counter
+ *  \param idx index into \a ctrg counter group */
+static inline void rate_ctr_inc2(struct rate_ctr_group *ctrg, unsigned int idx)
+{
+	rate_ctr_inc(&ctrg->ctr[idx]);
+}
+
+
 /*! Return the counter difference since the last call to this function */
 int64_t rate_ctr_difference(struct rate_ctr *ctr);
 

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

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



More information about the gerrit-log mailing list