Browse code

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

Daniel-Constantin Mierla authored on 14/05/2021 08:33:33
Showing 1 changed files
... ...
@@ -54,34 +54,7 @@ static int mod_init(void)
54 54
  * *group_id is set to null in the former case.
55 55
  * Warning: changes the group string
56 56
  */
57
-static int get_group_id(str *group, unsigned int **group_id)
58
-{
59
-	static unsigned int	id;
60
-	str	s;
61
-
62
-	if (!group->s || (group->s[group->len-1] != ']')) {
63
-		*group_id = NULL;
64
-		return 0;
65
-	}
66
-
67
-	s.s = group->s + group->len - 2;
68
-	s.len = 0;
69
-	while ((s.s > group->s) && (*s.s != '[')) {
70
-		s.s--;
71
-		s.len++;
72
-	}
73
-	if (s.s == group->s) /* '[' not found */
74
-		return -1;
75
-	group->len = s.s - group->s;
76
-	s.s++;
77
-	if (!group->len || !s.len)
78
-		return -1;
79
-	if (str2int(&s, &id))
80
-		return -1;
81
-
82
-	*group_id = &id;
83
-	return 0;
84
-}
57
+#define get_group_id(group, group_id) cfg_get_group_id(group, group_id)
85 58
 
86 59
 static const char* rpc_set_now_doc[2] = {
87 60
         "Set the value of a configuration variable and commit the change immediately",