| 198 | } |
| 199 | |
| 200 | static void __bencode_container_add(bencode_item_t *parent, bencode_item_t *child) { |
| 201 | if (!parent) |
| 202 | return; |
| 203 | if (!child) |
| 204 | return; |
| 205 | |
| 206 | assert(child->parent == NULL); |
| 207 | assert(child->sibling == NULL); |
| 208 | |
| 209 | child->parent = parent; |
| 210 | if (parent->last_child) |
| 211 | parent->last_child->sibling = child; |
| 212 | parent->last_child = child; |
| 213 | if (!parent->child) |
| 214 | parent->child = child; |
| 215 | |
| 216 | while (parent) { |
| 217 | parent->iov_cnt += child->iov_cnt; |
| 218 | parent->str_len += child->str_len; |
| 219 | parent = parent->parent; |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | static 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) |
no outgoing calls
no test coverage detected