laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmocore/+/32048 )
Change subject: rate_ctr: Add rate_ctr_add2() similar to rate_ctr_inc2()
......................................................................
rate_ctr: Add rate_ctr_add2() similar to rate_ctr_inc2()
The convenience wrapper relieves the caller from manually resolving
the individual counter, and instead specify just the counter group
and the index.
Change-Id: If93e8b4fb0b86a87358f32d2b45438ca1887e9f3
---
M include/osmocom/core/rate_ctr.h
1 file changed, 22 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/32048/1
diff --git a/include/osmocom/core/rate_ctr.h b/include/osmocom/core/rate_ctr.h
index d944cc0..0a3eb2c 100644
--- a/include/osmocom/core/rate_ctr.h
+++ b/include/osmocom/core/rate_ctr.h
@@ -86,6 +86,15 @@
* \param inc quantity to increment \a ctr by */
void rate_ctr_add(struct rate_ctr *ctr, int inc);
+/*! Increment the counter by \a inc
+ * \param ctrg \ref rate_ctr_group of counter
+ * \param idx index into \a ctrg counter group
+ * \param inc quantity to increment \a ctr by */
+static inline void rate_ctr_add2(struct rate_ctr_group *ctrg, unsigned int idx, int inc)
+{
+ rate_ctr_add(rate_ctr_group_get_ctr(ctrg, idx), inc);
+}
+
/*! Increment the counter by 1
* \param ctr \ref rate_ctr to increment */
static inline void rate_ctr_inc(struct rate_ctr *ctr)
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/32048
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If93e8b4fb0b86a87358f32d2b45438ca1887e9f3
Gerrit-Change-Number: 32048
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange