pespin has uploaded this change for review.

View Change

ss7_instance: Only call osmo_ss7_pc_width() when needed

Change-Id: Ie0728cef36c1cbeb755baef105f3ab88d025db01
---
M src/ss7_instance.c
1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/84/43384/1
diff --git a/src/ss7_instance.c b/src/ss7_instance.c
index 05f6be8..b349974 100644
--- a/src/ss7_instance.c
+++ b/src/ss7_instance.c
@@ -671,15 +671,15 @@

int osmo_ss7_pointcode_parse_mask_or_len(const struct osmo_ss7_instance *inst, const char *in)
{
- unsigned int width = osmo_ss7_pc_width(inst ? &inst->cfg.pc_fmt : &default_pc_fmt);
-
if (in[0] == '/') {
/* parse mask by length */
+ unsigned int width;
int masklen = atoi(in+1);
if (masklen < 0 || masklen > 32)
return -EINVAL;
if (masklen == 0)
return 0;
+ width = osmo_ss7_pc_width(inst ? &inst->cfg.pc_fmt : &default_pc_fmt);
return (0xFFFFFFFF << (width - masklen)) & ((1 << width)-1);
}
/* parse mask as point code */

To view, visit change 43384. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ie0728cef36c1cbeb755baef105f3ab88d025db01
Gerrit-Change-Number: 43384
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>