neels has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-hnbgw/+/32617 )

Change subject: eliminate function hnb_contexts()
......................................................................

eliminate function hnb_contexts()

It's really just a bloated llist_count() wrapper.
(Cosmetic preparation for separate osmo_hnbgw_main.c file)

Change-Id: Icd4100ddeb98f4dc2e2ec6de2d44a4b861a66078
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw.c
2 files changed, 14 insertions(+), 15 deletions(-)

Approvals:
  daniel: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 1bf140a..1d46cda 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -178,7 +178,6 @@
 struct hnb_context *hnb_context_by_id(struct hnb_gw *gw, uint32_t cid);
 struct hnb_context *hnb_context_by_identity_info(struct hnb_gw *gw, const char 
*identity_info);
 const char *hnb_context_name(struct hnb_context *ctx);
-unsigned hnb_contexts(const struct hnb_gw *gw);

 struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id);
 struct ue_context *ue_context_by_imsi(struct hnb_gw *gw, const char *imsi);
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index 4885a2c..8c6a293 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -133,19 +133,6 @@
        return NULL;
 }

-
-unsigned hnb_contexts(const struct hnb_gw *gw)
-{
-       unsigned num_ctx = 0;
-       struct hnb_context *hnb;
-
-       llist_for_each_entry(hnb, &gw->hnb_list, list) {
-               num_ctx++;
-       }
-
-       return num_ctx;
-}
-
 struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id)
 {
        struct ue_context *ue;
@@ -640,7 +627,8 @@
 CTRL_CMD_DEFINE_RO(hnbs, "num-hnb");
 static int get_hnbs(struct ctrl_cmd *cmd, void *data)
 {
-       cmd->reply = talloc_asprintf(cmd, "%u", hnb_contexts(data));
+       struct hnb_gw *gw = data;
+       cmd->reply = talloc_asprintf(cmd, "%u", llist_count(&gw->hnb_list));

        return CTRL_CMD_REPLY;
 }

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

Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Icd4100ddeb98f4dc2e2ec6de2d44a4b861a66078
Gerrit-Change-Number: 32617
Gerrit-PatchSet: 2
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to