Browse Source

MT#55283 obsolete _add_string_dup

Change-Id: Iecd400f637585a4a690cca0f224887744e8f7b23
rfuchs/gh1842
Richard Fuchs 1 year ago
parent
commit
d3596597fc
3 changed files with 7 additions and 21 deletions
  1. +3
    -3
      daemon/call_interfaces.c
  2. +4
    -4
      daemon/statistics.c
  3. +0
    -14
      include/bencode.h

+ 3
- 3
daemon/call_interfaces.c View File

@ -2374,7 +2374,7 @@ static void ng_stats_endpoint(bencode_item_t *dict, const endpoint_t *ep) {
if (!ep->address.family) if (!ep->address.family)
return; return;
bencode_dictionary_add_string(dict, "family", ep->address.family->name); bencode_dictionary_add_string(dict, "family", ep->address.family->name);
bencode_dictionary_add_string_dup(dict, "address", sockaddr_print_buf(&ep->address));
bencode_dictionary_add_str_dup(dict, "address", &STR(sockaddr_print_buf(&ep->address)));
bencode_dictionary_add_integer(dict, "port", ep->port); bencode_dictionary_add_integer(dict, "port", ep->port);
} }
@ -2413,8 +2413,8 @@ static void ng_stats_stream(bencode_item_t *list, const struct packet_stream *ps
if (ps->selected_sfd) { if (ps->selected_sfd) {
bencode_dictionary_add_integer(dict, "local port", ps->selected_sfd->socket.local.port); bencode_dictionary_add_integer(dict, "local port", ps->selected_sfd->socket.local.port);
bencode_dictionary_add_string_dup(dict, "local address",
sockaddr_print_buf(&ps->selected_sfd->socket.local.address));
bencode_dictionary_add_str_dup(dict, "local address",
&STR(sockaddr_print_buf(&ps->selected_sfd->socket.local.address)));
bencode_dictionary_add_string(dict, "family", ps->selected_sfd->socket.local.address.family->name); bencode_dictionary_add_string(dict, "family", ps->selected_sfd->socket.local.address.family->name);
} }
ng_stats_endpoint(bencode_dictionary_add_dictionary(dict, "endpoint"), &ps->endpoint); ng_stats_endpoint(bencode_dictionary_add_dictionary(dict, "endpoint"), &ps->endpoint);


+ 4
- 4
daemon/statistics.c View File

@ -971,11 +971,11 @@ const char *statistics_ng(bencode_item_t *input, bencode_item_t *output) {
bencode_dictionary_add_integer(dict, bencode_strdup(buf, m->label), bencode_dictionary_add_integer(dict, bencode_strdup(buf, m->label),
m->int_value); m->int_value);
else if (m->value_raw) else if (m->value_raw)
bencode_dictionary_add_string_dup(dict, bencode_strdup(buf, m->label),
m->value_raw);
bencode_dictionary_add_str_dup(dict, bencode_strdup(buf, m->label),
&STR(m->value_raw));
else else
bencode_dictionary_add_string_dup(dict, bencode_strdup(buf, m->label),
m->value_short);
bencode_dictionary_add_str_dup(dict, bencode_strdup(buf, m->label),
&STR(m->value_short));
continue; continue;
} }


+ 0
- 14
include/bencode.h View File

@ -114,7 +114,6 @@ bencode_item_t *bencode_dictionary_add_len(bencode_item_t *dict, const char *key
/* Convenience function to add a string value to a dictionary, possibly duplicated into the /* Convenience function to add a string value to a dictionary, possibly duplicated into the
* bencode_buffer_t object. */ * bencode_buffer_t object. */
INLINE bencode_item_t *bencode_dictionary_add_string(bencode_item_t *dict, const char *key, const char *val); INLINE bencode_item_t *bencode_dictionary_add_string(bencode_item_t *dict, const char *key, const char *val);
INLINE bencode_item_t *bencode_dictionary_add_string_dup(bencode_item_t *dict, const char *key, const char *val);
/* Ditto, but for a "str" object */ /* Ditto, but for a "str" object */
INLINE bencode_item_t *bencode_dictionary_add_str(bencode_item_t *dict, const char *key, const str *val); INLINE bencode_item_t *bencode_dictionary_add_str(bencode_item_t *dict, const char *key, const str *val);
@ -138,7 +137,6 @@ bencode_item_t *bencode_list_add(bencode_item_t *list, bencode_item_t *item);
/* Convenience function to add the respective (newly created) objects to a list */ /* Convenience function to add the respective (newly created) objects to a list */
INLINE bencode_item_t *bencode_list_add_string(bencode_item_t *list, const char *s); INLINE bencode_item_t *bencode_list_add_string(bencode_item_t *list, const char *s);
INLINE bencode_item_t *bencode_list_add_string_dup(bencode_item_t *list, const char *s);
INLINE bencode_item_t *bencode_list_add_str(bencode_item_t *list, const str *s); INLINE bencode_item_t *bencode_list_add_str(bencode_item_t *list, const str *s);
INLINE bencode_item_t *bencode_list_add_str_dup(bencode_item_t *list, const str *s); INLINE bencode_item_t *bencode_list_add_str_dup(bencode_item_t *list, const str *s);
INLINE bencode_item_t *bencode_list_add_list(bencode_item_t *list); INLINE bencode_item_t *bencode_list_add_list(bencode_item_t *list);
@ -404,12 +402,6 @@ INLINE bencode_item_t *bencode_dictionary_add_string(bencode_item_t *dict, const
return bencode_dictionary_add(dict, key, bencode_string(bencode_item_buffer(dict), val)); return bencode_dictionary_add(dict, key, bencode_string(bencode_item_buffer(dict), val));
} }
INLINE bencode_item_t *bencode_dictionary_add_string_dup(bencode_item_t *dict, const char *key, const char *val) {
if (!val)
return NULL;
return bencode_dictionary_add(dict, key, bencode_string_dup(bencode_item_buffer(dict), val));
}
INLINE bencode_item_t *bencode_dictionary_add_str(bencode_item_t *dict, const char *key, const str *val) { INLINE bencode_item_t *bencode_dictionary_add_str(bencode_item_t *dict, const char *key, const str *val) {
if (!val) if (!val)
return NULL; return NULL;
@ -444,12 +436,6 @@ INLINE bencode_item_t *bencode_list_add_string(bencode_item_t *list, const char
return bencode_list_add(list, bencode_string(bencode_item_buffer(list), s)); return bencode_list_add(list, bencode_string(bencode_item_buffer(list), s));
} }
INLINE bencode_item_t *bencode_list_add_string_dup(bencode_item_t *list, const char *s) {
if (!s)
return NULL;
return bencode_list_add(list, bencode_string_dup(bencode_item_buffer(list), s));
}
INLINE bencode_item_t *bencode_list_add_str(bencode_item_t *list, const str *s) { INLINE bencode_item_t *bencode_list_add_str(bencode_item_t *list, const str *s) {
return bencode_list_add(list, bencode_str(bencode_item_buffer(list), s)); return bencode_list_add(list, bencode_str(bencode_item_buffer(list), s));
} }


Loading…
Cancel
Save