TT#45472 avoid an unnecessary implicit call to strlen

Change-Id: Ic45451ed3bab3d3724e4dadd43026529d3abc707
changes/69/25369/2
Richard Fuchs 7 years ago
parent d08d84071a
commit 18ec141d2b

@ -950,7 +950,7 @@ static const char *call_offer_answer_ng(bencode_item_t *input,
goto out;
if (chopper->output->len)
bencode_dictionary_add_string(output, "sdp", chopper->output->str);
bencode_dictionary_add_string_len(output, "sdp", chopper->output->str, chopper->output->len);
errstr = NULL;
out:

@ -126,6 +126,7 @@ bencode_item_t *bencode_dictionary_add_len(bencode_item_t *dict, const char *key
* 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);
INLINE bencode_item_t *bencode_dictionary_add_string_len(bencode_item_t *dict, const char *key, const char *val, int len);
/* Ditto, but for a "str" object */
INLINE bencode_item_t *bencode_dictionary_add_str(bencode_item_t *dict, const char *key, const str *val);
@ -407,6 +408,12 @@ 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_len(bencode_item_t *dict, const char *key, const char *val, int len) {
if (!val)
return NULL;
return bencode_dictionary_add(dict, key, bencode_string_len(bencode_item_buffer(dict), val, len));
}
INLINE bencode_item_t *bencode_dictionary_add_string_dup(bencode_item_t *dict, const char *key, const char *val) {
if (!val)
return NULL;

Loading…
Cancel
Save