pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/38663?usp=email )
Change subject: sigtran: Split osmo_ss7_instance allocation into its own function
......................................................................
sigtran: Split osmo_ss7_instance allocation into its own function
Change-Id: I38f9f19bb43d29999c4a7ba1a537403d1d58e880
---
M src/osmo_ss7.c
1 file changed, 19 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/63/38663/1
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index f82e28e..2486378 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -326,21 +326,11 @@
return NULL;
}
-/*! \brief Find or create a SS7 Instance
- * \param[in] ctx talloc allocation context to use for allocations
- * \param[in] id ID of SS7 Instance
- * \returns \ref osmo_ss7_instance on success; NULL on error */
-struct osmo_ss7_instance *
-osmo_ss7_instance_find_or_create(void *ctx, uint32_t id)
+static struct osmo_ss7_instance *
+ss7_instance_alloc(void *ctx, uint32_t id)
{
struct osmo_ss7_instance *inst;
- OSMO_ASSERT(ss7_initialized);
-
- inst = osmo_ss7_instance_find(id);
- if (inst)
- return inst;
-
inst = talloc_zero(ctx, struct osmo_ss7_instance);
if (!inst)
return NULL;
@@ -371,6 +361,23 @@
return inst;
}
+/*! \brief Find or create a SS7 Instance
+ * \param[in] ctx talloc allocation context to use for allocations
+ * \param[in] id ID of SS7 Instance
+ * \returns \ref osmo_ss7_instance on success; NULL on error */
+struct osmo_ss7_instance *
+osmo_ss7_instance_find_or_create(void *ctx, uint32_t id)
+{
+ struct osmo_ss7_instance *inst;
+
+ OSMO_ASSERT(ss7_initialized);
+
+ inst = osmo_ss7_instance_find(id);
+ if (!inst)
+ inst = ss7_instance_alloc(ctx, id);
+ return inst;
+}
+
/*! \brief Destroy a SS7 Instance
* \param[in] inst SS7 Instance to be destroyed */
void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst)
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/38663?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I38f9f19bb43d29999c4a7ba1a537403d1d58e880
Gerrit-Change-Number: 38663
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>