| 374 | } |
| 375 | |
| 376 | const XpackLookupResult |
| 377 | XpackDynamicTable::duplicate_entry(uint32_t current_index) |
| 378 | { |
| 379 | const char *name = nullptr; |
| 380 | size_t name_len = 0; |
| 381 | const char *value = nullptr; |
| 382 | size_t value_len = 0; |
| 383 | char *duped_name; |
| 384 | char *duped_value; |
| 385 | |
| 386 | XpackLookupResult result = this->lookup(current_index, &name, &name_len, &value, &value_len); |
| 387 | if (result.match_type != XpackLookupResult::MatchType::EXACT) { |
| 388 | return result; |
| 389 | } |
| 390 | |
| 391 | // We need to dup name and value to avoid memcpy-param-overlap |
| 392 | duped_name = ats_strndup(name, name_len); |
| 393 | duped_value = ats_strndup(value, value_len); |
| 394 | result = this->insert_entry(duped_name, name_len, duped_value, value_len); |
| 395 | ats_free(duped_name); |
| 396 | ats_free(duped_value); |
| 397 | |
| 398 | return result; |
| 399 | } |
| 400 | |
| 401 | bool |
| 402 | XpackDynamicTable::should_duplicate(uint32_t /* index ATS_UNUSED */) |
no test coverage detected