diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 99b7c4cb2..5a0d8d811 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -2374,7 +2374,7 @@ static void ng_stats_endpoint(bencode_item_t *dict, const endpoint_t *ep) { if (!ep->address.family) return; 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); } @@ -2413,8 +2413,8 @@ static void ng_stats_stream(bencode_item_t *list, const struct packet_stream *ps if (ps->selected_sfd) { 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); } ng_stats_endpoint(bencode_dictionary_add_dictionary(dict, "endpoint"), &ps->endpoint); diff --git a/daemon/statistics.c b/daemon/statistics.c index 68e6e8e6d..2f51865c6 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -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), m->int_value); 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 - 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; } diff --git a/include/bencode.h b/include/bencode.h index ee15d61ac..d74e294ac 100644 --- a/include/bencode.h +++ b/include/bencode.h @@ -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 * 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_dup(bencode_item_t *dict, const char *key, const char *val); /* Ditto, but for a "str" object */ 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 */ 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_dup(bencode_item_t *list, const str *s); 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)); } -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) { if (!val) 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)); } -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) { return bencode_list_add(list, bencode_str(bencode_item_buffer(list), s)); }