mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Document that String{,Impl} contains NUL-terminator
This commit is contained in:
parent
417ca7594b
commit
2adc3c61a2
Notes:
sideshowbarker
2024-07-19 03:14:52 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/2adc3c61a21 Pull-request: https://github.com/SerenityOS/serenity/pull/3275 Reviewed-by: https://github.com/awesomekling
2 changed files with 2 additions and 0 deletions
|
@ -142,6 +142,7 @@ public:
|
|||
bool is_null() const { return !m_impl; }
|
||||
ALWAYS_INLINE bool is_empty() const { return length() == 0; }
|
||||
ALWAYS_INLINE size_t length() const { return m_impl ? m_impl->length() : 0; }
|
||||
// Includes NUL-terminator, if non-nullptr.
|
||||
ALWAYS_INLINE const char* characters() const { return m_impl ? m_impl->characters() : nullptr; }
|
||||
|
||||
ALWAYS_INLINE ReadonlyBytes bytes() const { return m_impl ? m_impl->bytes() : nullptr; }
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
~StringImpl();
|
||||
|
||||
size_t length() const { return m_length; }
|
||||
// Includes NUL-terminator.
|
||||
const char* characters() const { return &m_inline_buffer[0]; }
|
||||
|
||||
ALWAYS_INLINE ReadonlyBytes bytes() const { return { characters(), length() }; }
|
||||
|
|
Loading…
Reference in a new issue