MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / __bencode_string_alloc

Function __bencode_string_alloc

modules/rtpengine/bencode.c:223–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223static bencode_item_t *__bencode_string_alloc(bencode_buffer_t *buf, const void *base,
224 int str_len, int iov_len, int iov_cnt, bencode_type_t type)
225{
226 bencode_item_t *ret;
227 int len_len;
228
229 assert((str_len <= 99999) && (str_len >= 0));
230 ret = __bencode_item_alloc(buf, 7);
231 if (!ret)
232 return NULL;
233 len_len = sprintf(ret->__buf, "%d:", str_len);
234
235 ret->type = type;
236 ret->iov[0].iov_base = ret->__buf;
237 ret->iov[0].iov_len = len_len;
238 ret->iov[1].iov_base = (void *) base;
239 ret->iov[1].iov_len = iov_len;
240 ret->iov_cnt = iov_cnt + 1;
241 ret->str_len = len_len + str_len;
242
243 return ret;
244}
245
246bencode_item_t *bencode_string_len_dup(bencode_buffer_t *buf, const char *s, int len) {
247 char *sd = __bencode_alloc(buf, len);

Callers 2

bencode_string_lenFunction · 0.85
bencode_string_iovecFunction · 0.85

Calls 1

__bencode_item_allocFunction · 0.85

Tested by

no test coverage detected