[sr-dev] [kamailio/kamailio] cfg_rpc: extending the functionality of cfg.get command (#1321)

Daniel-Constantin Mierla notifications at github.com
Thu Nov 23 10:30:16 CET 2017


miconda commented on this pull request.



> +	str     group, var;
+	void    *val;
+	unsigned int    val_type;
+	int     ret, n;
+	unsigned int    *group_id;
+
+	n = rpc->scan(c, "SS", &group, &var);
+	/*  2: both group and variable name are present
+	 * -1: only group is present, print all variables in the group */
+	if(n<2) {
+		if (n == -1) {
+			var.s = NULL;
+			var.len = 0;
+		}
+		else return;
+	}

I think that the right way is to read with optional specifier `*`:

```
n = rpc->scan(c, "S*S", &group, &var);
```

The n is two if both were read or 1 if only group is read.

When n is -1, there can be other errors.

Otherwise, the patch is useful, thanks!

Can you do a new patch based on what I suggested? It can be a follow up of this one, we can squash from the web when merging.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1321#pullrequestreview-78659969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20171123/c0045a67/attachment.html>


More information about the sr-dev mailing list