| 377 | } |
| 378 | |
| 379 | HOSTDEVICE static inline char *PD_PString_GetMutableDataPointer( |
| 380 | PD_PString *str) { |
| 381 | switch (PD_PString_GetType(str)) { |
| 382 | case PD_PSTR_SMALL: |
| 383 | return str->u.small.str; |
| 384 | case PD_PSTR_OFFSET: |
| 385 | case PD_PSTR_VIEW: |
| 386 | // Convert OFFSET/VIEW to SMALL/LARGE |
| 387 | PD_PString_ResizeUninitialized(str, PD_PString_GetSize(str)); |
| 388 | return (PD_PString_GetType(str) == PD_PSTR_SMALL) ? str->u.small.str |
| 389 | : str->u.large.ptr; |
| 390 | case PD_PSTR_LARGE: |
| 391 | return str->u.large.ptr; |
| 392 | default: |
| 393 | // Unreachable. |
| 394 | return NULL; // NOLINT |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | HOSTDEVICE static inline void PD_PString_Reserve(PD_PString *str, |
| 399 | size_t new_cap) { |
no test coverage detected