[sr-dev] git:master:9fcb5710: cfg-rpc: get_group_id() pints to cfg_get_group_id()

Daniel-Constantin Mierla miconda at gmail.com
Fri May 14 10:43:36 CEST 2021


Module: kamailio
Branch: master
Commit: 9fcb5710e01b61c91df85bcf144cbda68b730ae0
URL: https://github.com/kamailio/kamailio/commit/9fcb5710e01b61c91df85bcf144cbda68b730ae0

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-05-14T10:33:33+02:00

cfg-rpc: get_group_id() pints to cfg_get_group_id()

---

Modified: src/modules/cfg_rpc/cfg_rpc.c

---

Diff:  https://github.com/kamailio/kamailio/commit/9fcb5710e01b61c91df85bcf144cbda68b730ae0.diff
Patch: https://github.com/kamailio/kamailio/commit/9fcb5710e01b61c91df85bcf144cbda68b730ae0.patch

---

diff --git a/src/modules/cfg_rpc/cfg_rpc.c b/src/modules/cfg_rpc/cfg_rpc.c
index 2cab2a47cd..e31429f713 100644
--- a/src/modules/cfg_rpc/cfg_rpc.c
+++ b/src/modules/cfg_rpc/cfg_rpc.c
@@ -54,34 +54,7 @@ static int mod_init(void)
  * *group_id is set to null in the former case.
  * Warning: changes the group string
  */
-static int get_group_id(str *group, unsigned int **group_id)
-{
-	static unsigned int	id;
-	str	s;
-
-	if (!group->s || (group->s[group->len-1] != ']')) {
-		*group_id = NULL;
-		return 0;
-	}
-
-	s.s = group->s + group->len - 2;
-	s.len = 0;
-	while ((s.s > group->s) && (*s.s != '[')) {
-		s.s--;
-		s.len++;
-	}
-	if (s.s == group->s) /* '[' not found */
-		return -1;
-	group->len = s.s - group->s;
-	s.s++;
-	if (!group->len || !s.len)
-		return -1;
-	if (str2int(&s, &id))
-		return -1;
-
-	*group_id = &id;
-	return 0;
-}
+#define get_group_id(group, group_id) cfg_get_group_id(group, group_id)
 
 static const char* rpc_set_now_doc[2] = {
         "Set the value of a configuration variable and commit the change immediately",




More information about the sr-dev mailing list