summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]AK/String.h10
-rw-r--r--AK/StringImpl.cpp17
-rw-r--r--AK/StringImpl.h4
-rw-r--r--AK/Tests/TestString.cpp1
4 files changed, 4 insertions, 28 deletions
diff --git a/AK/String.h b/AK/String.h
index fd0b707a42..2b299841b9 100644..100755
--- a/AK/String.h
+++ b/AK/String.h
@@ -110,13 +110,6 @@ public:
return m_impl->to_uppercase();
}
- String reversed() const
- {
- if (!m_impl)
- return String();
- return m_impl->reversed();
- }
-
Vector<String> split_limit(char separator, int limit) const;
Vector<String> split(char separator) const;
String substring(int start, int length) const;
@@ -234,6 +227,7 @@ struct Traits<String> : public GenericTraits<String> {
struct CaseInsensitiveStringTraits : public AK::Traits<String> {
static unsigned hash(const String& s) { return s.impl() ? s.to_lowercase().impl()->hash() : 0; }
static bool equals(const String& a, const String& b) { return a.to_lowercase() == b.to_lowercase(); }
+
};
inline bool operator<(const char* characters, const String& string)
@@ -270,5 +264,5 @@ inline bool operator<=(const char* characters, const String& string)
}
-using AK::CaseInsensitiveStringTraits;
using AK::String;
+using AK::CaseInsensitiveStringTraits;
diff --git a/AK/StringImpl.cpp b/AK/StringImpl.cpp
index a036ef250c..5e8c6d9090 100644
--- a/AK/StringImpl.cpp
+++ b/AK/StringImpl.cpp
@@ -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;
-}
-
}
diff --git a/AK/StringImpl.h b/AK/StringImpl.h
index d00a8dc857..b2b085f81d 100644
--- a/AK/StringImpl.h
+++ b/AK/StringImpl.h
@@ -1,7 +1,7 @@
#pragma once
-#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
+#include <AK/RefCounted.h>
#include <AK/Types.h>
#include <AK/kmalloc.h>
@@ -44,8 +44,6 @@ public:
return m_hash;
}
- NonnullRefPtr<StringImpl> reversed() const;
-
private:
enum ConstructTheEmptyStringImplTag {
ConstructTheEmptyStringImpl
diff --git a/AK/Tests/TestString.cpp b/AK/Tests/TestString.cpp
index 03fbb51641..9a427d302e 100644
--- a/AK/Tests/TestString.cpp
+++ b/AK/Tests/TestString.cpp
@@ -41,7 +41,6 @@ TEST_CASE(compare)
EXPECT(!("a" >= String("b")));
EXPECT("a" <= String("a"));
EXPECT(!("b" <= String("a")));
- EXPECT(!strcmp(test_string.reversed().characters(), "FEDCBA"));
}
TEST_CASE(index_access)