Browse Source

MT#55283 add *list_add_str_dup method

Change-Id: Ic6dac373f9fb16a83e20d12ff7f05d272633e859
pull/1848/head
Richard Fuchs 1 year ago
parent
commit
8aba2b3e6f
3 changed files with 6 additions and 3 deletions
  1. +3
    -3
      daemon/call_interfaces.c
  2. +2
    -0
      daemon/control_ng.c
  3. +1
    -0
      include/control_ng.h

+ 3
- 3
daemon/call_interfaces.c View File

@ -2742,7 +2742,7 @@ stats:
}
}
static void ng_list_calls(bencode_item_t *output, long long int limit) {
static void ng_list_calls(ng_parser_ctx_t *ctx, bencode_item_t *output, long long int limit) {
rtpe_calls_ht_iter iter;
rwlock_lock_r(&rtpe_callhash_lock);
@ -2750,7 +2750,7 @@ static void ng_list_calls(bencode_item_t *output, long long int limit) {
t_hash_table_iter_init (&iter, rtpe_callhash);
str *key;
while (limit-- && t_hash_table_iter_next (&iter, &key, NULL)) {
bencode_list_add_str_dup(output, key);
ctx->parser->list_add_str_dup(output, key);
}
rwlock_unlock_r(&rtpe_callhash_lock);
@ -2792,7 +2792,7 @@ const char *call_list_ng(ng_parser_ctx_t *ctx) {
}
calls = ctx->parser->dict_add_list(output, "calls");
ng_list_calls(calls, limit);
ng_list_calls(ctx, calls, limit);
return NULL;
}


+ 2
- 0
daemon/control_ng.c View File

@ -346,6 +346,7 @@ const ng_parser_t ng_parser_native = {
.list_add = bencode_list_add,
.list_add_dict = bencode_list_add_dictionary,
.list_add_string = bencode_list_add_string,
.list_add_str_dup = bencode_list_add_str_dup,
.pretty_print = bencode_pretty_print,
};
const ng_parser_t ng_parser_json = {
@ -375,6 +376,7 @@ const ng_parser_t ng_parser_json = {
.list_add = bencode_list_add,
.list_add_dict = bencode_list_add_dictionary,
.list_add_string = bencode_list_add_string,
.list_add_str_dup = bencode_list_add_str_dup,
.pretty_print = json_pretty_print,
};


+ 1
- 0
include/control_ng.h View File

@ -144,6 +144,7 @@ struct ng_parser {
parser_arg (*list)(ng_parser_ctx_t *);
bencode_item_t *(*list_add)(parser_arg, parser_arg);
bencode_item_t *(*list_add_dict)(bencode_item_t *);
void (*list_add_str_dup)(parser_arg, const str *);
void (*list_add_string)(bencode_item_t *, const char *);
void (*pretty_print)(parser_arg, GString *);
};


Loading…
Cancel
Save