| 249 | const char *ptr() const { return m_ptr; } |
| 250 | char *ptr() { return m_ptr; } |
| 251 | char *c_ptr() { |
| 252 | assert(!m_is_alloced || !m_ptr || !m_alloced_length || |
| 253 | (m_alloced_length >= (m_length + 1))); |
| 254 | |
| 255 | /* |
| 256 | Should be safe, but in case valgrind complains on this line, it means |
| 257 | there is a misuse of c_ptr(). Please prefer <ptr(), length()> instead. |
| 258 | */ |
| 259 | if (!m_ptr || m_ptr[m_length]) (void)mem_realloc(m_length); |
| 260 | return m_ptr; |
| 261 | } |
| 262 | char *c_ptr_quick() { |
| 263 | if (m_ptr && m_length < m_alloced_length) m_ptr[m_length] = 0; |
| 264 | return m_ptr; |