1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 07:44:59 +00:00

Revert "AK: Made Strings reversible"

This reverts commit 26e81ad574.

We forgot to consider UTF-8 here. String is UTF-8 and we need to be
careful about things like this.
This commit is contained in:
Andreas Kling 2019-09-13 14:37:25 +02:00
parent 2d1f3ec749
commit 09e89cc55d
4 changed files with 4 additions and 28 deletions

View file

@ -4,7 +4,7 @@
#include "kmalloc.h"
#ifndef __serenity__
# include <new>
#include <new>
#endif
//#define DEBUG_STRINGIMPL
@ -172,19 +172,4 @@ void StringImpl::compute_hash() const
m_has_hash = true;
}
NonnullRefPtr<StringImpl> StringImpl::reversed() const
{
if (m_length == 0)
return the_empty_stringimpl();
char* buffer;
const char* pos = &m_inline_buffer[m_length - 1];
auto new_impl = create_uninitialized(m_length, buffer);
for (int i = 0; i < m_length; i++)
buffer[i] = *pos--;
return new_impl;
}
}