| 1700 | #endif |
| 1701 | |
| 1702 | inline bool strcpy_insitu_allow(size_t length, uintptr_t allocated, char_t* target) |
| 1703 | { |
| 1704 | assert(target); |
| 1705 | size_t target_length = strlength(target); |
| 1706 | |
| 1707 | // always reuse document buffer memory if possible |
| 1708 | if (!allocated) |
| 1709 | return target_length >= length; |
| 1710 | |
| 1711 | // reuse heap memory if waste is not too great |
| 1712 | const size_t reuse_threshold = 32; |
| 1713 | |
| 1714 | return target_length >= length && (target_length < reuse_threshold || target_length - length < target_length / 2); |
| 1715 | } |
| 1716 | |
| 1717 | PUGI__FN bool strcpy_insitu(char_t*& dest, uintptr_t& header, uintptr_t header_mask, const char_t* source) |
| 1718 | { |
no test coverage detected