Push new gap, move s count bytes further (skipping the gap). Collapse previous gap.
| 1777 | // Push new gap, move s count bytes further (skipping the gap). |
| 1778 | // Collapse previous gap. |
| 1779 | void push(char_t*& s, size_t count) |
| 1780 | { |
| 1781 | if (end) // there was a gap already; collapse it |
| 1782 | { |
| 1783 | // Move [old_gap_end, new_gap_start) to [old_gap_start, ...) |
| 1784 | assert(s >= end); |
| 1785 | memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); |
| 1786 | } |
| 1787 | |
| 1788 | s += count; // end of current gap |
| 1789 | |
| 1790 | // "merge" two gaps |
| 1791 | end = s; |
| 1792 | size += count; |
| 1793 | } |
| 1794 | |
| 1795 | // Collapse all gaps, return past-the-end pointer |
| 1796 | char_t* flush(char_t* s) |
no outgoing calls
no test coverage detected