Module: kamailio
Branch: master
Commit: c73a22abb1691e3c25b5f599e5f387540f152913
URL:
https://github.com/kamailio/kamailio/commit/c73a22abb1691e3c25b5f599e5f3875…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-05-05T07:36:56+02:00
dispatcher: declare vars at beginning of the block in rpc command
---
Modified: src/modules/dispatcher/dispatcher.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c73a22abb1691e3c25b5f599e5f3875…
Patch:
https://github.com/kamailio/kamailio/commit/c73a22abb1691e3c25b5f599e5f3875…
---
diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c
index 2c1e6fdbd0..f6ab6b1d70 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -1275,16 +1275,7 @@ static const char *dispatcher_rpc_list_doc[2] = {
*/
int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void *ctx, void *rpc_handle)
{
- if(!node)
- return 0;
-
int i = 0, rc = 0;
- for(; i < 2; ++i) {
- rc = ds_rpc_print_set(node->next[i], rpc, ctx, rpc_handle);
- if(rc != 0)
- return rc;
- }
-
void *rh;
void *sh;
void *vh;
@@ -1294,6 +1285,15 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void *ctx, void
*rpc_handle)
char c[3];
str data = STR_NULL;
+ if(!node)
+ return 0;
+
+ for(; i < 2; ++i) {
+ rc = ds_rpc_print_set(node->next[i], rpc, ctx, rpc_handle);
+ if(rc != 0)
+ return rc;
+ }
+
if(rpc->struct_add(rpc_handle, "{", "SET", &sh) < 0) {
rpc->fault(ctx, 500, "Internal error set structure");
return -1;