Change in libosmocore[master]: stat_item: cosmetic: s/desc/group_desc in osmo_stat_item_group_alloc()

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

neels gerrit-no-reply at lists.osmocom.org
Wed Sep 15 06:40:36 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/25461 )


Change subject: stat_item: cosmetic: s/desc/group_desc in osmo_stat_item_group_alloc()
......................................................................

stat_item: cosmetic: s/desc/group_desc in osmo_stat_item_group_alloc()

There also is an osmo_stat_item_desc, so the name 'desc' makes it hard
to read the code / the upcoming refactoring patches. It is an
osmo_stat_item_group_desc, so call it group_desc.

Related: SYS#5542
Change-Id: I07bc011450549a44ebf043e7d8a70718ddfd900e
---
M src/stat_item.c
1 file changed, 9 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/61/25461/1

diff --git a/src/stat_item.c b/src/stat_item.c
index 87cbfea..1788746 100644
--- a/src/stat_item.c
+++ b/src/stat_item.c
@@ -94,7 +94,7 @@
  *  \param[in] idx Index of new stat item group
  */
 struct osmo_stat_item_group *osmo_stat_item_group_alloc(void *ctx,
-					    const struct osmo_stat_item_group_desc *desc,
+					    const struct osmo_stat_item_group_desc *group_desc,
 					    unsigned int idx)
 {
 	unsigned int group_size;
@@ -105,7 +105,7 @@
 	struct osmo_stat_item_group *group;
 
 	group_size = sizeof(struct osmo_stat_item_group) +
-			desc->num_items * sizeof(struct osmo_stat_item *);
+			group_desc->num_items * sizeof(struct osmo_stat_item *);
 
 	if (!ctx)
 		ctx = tall_stat_item_ctx;
@@ -114,15 +114,15 @@
 	if (!group)
 		return NULL;
 
-	group->desc = desc;
+	group->desc = group_desc;
 	group->idx = idx;
 
 	/* Get combined size of all items */
-	for (item_idx = 0; item_idx < desc->num_items; item_idx++) {
+	for (item_idx = 0; item_idx < group_desc->num_items; item_idx++) {
 		unsigned int size;
 		size = sizeof(struct osmo_stat_item) +
 			sizeof(struct osmo_stat_item_value) *
-			desc->item_desc[item_idx].num_values;
+			group_desc->item_desc[item_idx].num_values;
 		/* Align to pointer size */
 		size = (size + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
 
@@ -139,18 +139,18 @@
 	}
 
 	/* Update item pointers */
-	for (item_idx = 0; item_idx < desc->num_items; item_idx++) {
+	for (item_idx = 0; item_idx < group_desc->num_items; item_idx++) {
 		struct osmo_stat_item *item = (struct osmo_stat_item *)
 			((uint8_t *)items + (unsigned long)group->items[item_idx]);
 		unsigned int i;
 
 		group->items[item_idx] = item;
-		item->last_offs = desc->item_desc[item_idx].num_values - 1;
+		item->last_offs = group_desc->item_desc[item_idx].num_values - 1;
 		item->stats_next_id = 1;
-		item->desc = &desc->item_desc[item_idx];
+		item->desc = &group_desc->item_desc[item_idx];
 
 		for (i = 0; i <= item->last_offs; i++) {
-			item->values[i].value = desc->item_desc[item_idx].default_value;
+			item->values[i].value = group_desc->item_desc[item_idx].default_value;
 			item->values[i].id = OSMO_STAT_ITEM_NOVALUE_ID;
 		}
 	}

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25461
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I07bc011450549a44ebf043e7d8a70718ddfd900e
Gerrit-Change-Number: 25461
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210915/e58b67cf/attachment.htm>


More information about the gerrit-log mailing list