mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:07:35 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -7,11 +7,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Result.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
struct DlErrorMessage {
|
||||
DlErrorMessage(String&& other)
|
||||
DlErrorMessage(DeprecatedString&& other)
|
||||
: text(move(other))
|
||||
{
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ struct DlErrorMessage {
|
|||
// from the one in libc.so
|
||||
virtual ~DlErrorMessage() = default;
|
||||
|
||||
String text;
|
||||
DeprecatedString text;
|
||||
};
|
||||
|
||||
struct __Dl_info;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Types.h>
|
||||
#include <bits/dlfcn_integration.h>
|
||||
#include <dlfcn.h>
|
||||
|
@ -25,7 +25,7 @@ __thread char* s_dlerror_text = NULL;
|
|||
__thread bool s_dlerror_retrieved = false;
|
||||
#endif
|
||||
|
||||
static void store_error(String const& error)
|
||||
static void store_error(DeprecatedString const& error)
|
||||
{
|
||||
free(s_dlerror_text);
|
||||
s_dlerror_text = strdup(error.characters());
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <errno.h>
|
||||
#include <errno_codes.h>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
|
@ -47,8 +47,8 @@ static char const* services_path = "/etc/services";
|
|||
|
||||
static bool fill_getserv_buffers(char const* line, ssize_t read);
|
||||
static servent __getserv_buffer;
|
||||
static String __getserv_name_buffer;
|
||||
static String __getserv_protocol_buffer;
|
||||
static DeprecatedString __getserv_name_buffer;
|
||||
static DeprecatedString __getserv_protocol_buffer;
|
||||
static int __getserv_port_buffer;
|
||||
static Vector<ByteBuffer> __getserv_alias_list_buffer;
|
||||
static Vector<char*> __getserv_alias_list;
|
||||
|
@ -61,7 +61,7 @@ static char const* protocols_path = "/etc/protocols";
|
|||
|
||||
static bool fill_getproto_buffers(char const* line, ssize_t read);
|
||||
static protoent __getproto_buffer;
|
||||
static String __getproto_name_buffer;
|
||||
static DeprecatedString __getproto_name_buffer;
|
||||
static Vector<ByteBuffer> __getproto_alias_list_buffer;
|
||||
static Vector<char*> __getproto_alias_list;
|
||||
static int __getproto_protocol_buffer;
|
||||
|
@ -89,7 +89,7 @@ static int connect_to_lookup_server()
|
|||
return fd;
|
||||
}
|
||||
|
||||
static String gethostbyname_name_buffer;
|
||||
static DeprecatedString gethostbyname_name_buffer;
|
||||
|
||||
hostent* gethostbyname(char const* name)
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ hostent* gethostbyname(char const* name)
|
|||
return &__gethostbyname_buffer;
|
||||
}
|
||||
|
||||
static String gethostbyaddr_name_buffer;
|
||||
static DeprecatedString gethostbyaddr_name_buffer;
|
||||
|
||||
hostent* gethostbyaddr(void const* addr, socklen_t addr_size, int type)
|
||||
{
|
||||
|
@ -467,7 +467,7 @@ static bool fill_getserv_buffers(char const* line, ssize_t read)
|
|||
}
|
||||
__getserv_name_buffer = split_line[0];
|
||||
|
||||
auto port_protocol_split = String(split_line[1]).split('/');
|
||||
auto port_protocol_split = DeprecatedString(split_line[1]).split('/');
|
||||
if (port_protocol_split.size() < 2) {
|
||||
warnln("getservent(): malformed services file");
|
||||
return false;
|
||||
|
@ -634,7 +634,7 @@ void endprotoent()
|
|||
|
||||
static bool fill_getproto_buffers(char const* line, ssize_t read)
|
||||
{
|
||||
String string_line = String(line, read);
|
||||
DeprecatedString string_line = DeprecatedString(line, read);
|
||||
auto split_line = string_line.replace(" "sv, "\t"sv, ReplaceMode::All).split('\t');
|
||||
|
||||
// This indicates an incorrect file format. Protocols file entries should
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Atomic.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <bits/pthread_cancel.h>
|
||||
#include <errno.h>
|
||||
|
@ -31,7 +31,7 @@ static constexpr u32 POST_WAKES = 1 << 31;
|
|||
|
||||
static constexpr auto sem_path_prefix = "/tmp/semaphore/"sv;
|
||||
static constexpr auto SEM_NAME_MAX = PATH_MAX - sem_path_prefix.length();
|
||||
static ErrorOr<String> sem_name_to_path(char const* name)
|
||||
static ErrorOr<DeprecatedString> sem_name_to_path(char const* name)
|
||||
{
|
||||
if (name[0] != '/')
|
||||
return EINVAL;
|
||||
|
@ -58,7 +58,7 @@ struct NamedSemaphore {
|
|||
sem_t* sem { nullptr };
|
||||
};
|
||||
|
||||
static HashMap<String, NamedSemaphore> s_named_semaphores;
|
||||
static HashMap<DeprecatedString, NamedSemaphore> s_named_semaphores;
|
||||
static pthread_mutex_t s_sem_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_once_t s_sem_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <errno.h>
|
||||
|
@ -21,8 +21,8 @@ static FILE* s_stream = nullptr;
|
|||
static unsigned s_line_number = 0;
|
||||
static struct spwd s_shadow_entry;
|
||||
|
||||
static String s_name;
|
||||
static String s_pwdp;
|
||||
static DeprecatedString s_name;
|
||||
static DeprecatedString s_pwdp;
|
||||
|
||||
void setspent()
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ struct spwd* getspnam(char const* name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool parse_shadow_entry(String const& line)
|
||||
static bool parse_shadow_entry(DeprecatedString const& line)
|
||||
{
|
||||
auto parts = line.split_view(':', SplitBehavior::KeepEmpty);
|
||||
if (parts.size() != 9) {
|
||||
|
@ -169,7 +169,7 @@ struct spwd* getspent()
|
|||
if ((!s || !s[0]) && feof(s_stream))
|
||||
return nullptr;
|
||||
|
||||
String line(s, Chomp);
|
||||
DeprecatedString line(s, Chomp);
|
||||
if (parse_shadow_entry(line))
|
||||
return &s_shadow_entry;
|
||||
// Otherwise, proceed to the next line.
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
|
||||
#include <AK/BuiltinWrappers.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/PrintfImplementation.h>
|
||||
#include <AK/ScopedValueRollback.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibC/bits/mutex_locker.h>
|
||||
#include <LibC/bits/stdio_file_implementation.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// Has to be defined before including due to legacy Unices
|
||||
#define SYSLOG_NAMES 1
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -124,7 +124,7 @@ void vsyslog_r(int priority, struct syslog_data* data, char const* message, va_l
|
|||
combined.appendff("{}: ", get_syslog_ident(data));
|
||||
|
||||
combined.appendvf(message, args);
|
||||
String combined_string = combined.build();
|
||||
DeprecatedString combined_string = combined.build();
|
||||
|
||||
if (data->logopt & LOG_CONS)
|
||||
dbgputstr(combined_string.characters(), combined_string.length());
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
@ -27,13 +27,13 @@ int __attribute__((weak)) tgetent([[maybe_unused]] char* bp, [[maybe_unused]] ch
|
|||
return 1;
|
||||
}
|
||||
|
||||
static HashMap<String, char const*>* caps = nullptr;
|
||||
static HashMap<DeprecatedString, char const*>* caps = nullptr;
|
||||
|
||||
static void ensure_caps()
|
||||
{
|
||||
if (caps)
|
||||
return;
|
||||
caps = new HashMap<String, char const*>;
|
||||
caps = new HashMap<DeprecatedString, char const*>;
|
||||
caps->set("DC", "\033[%p1%dP");
|
||||
caps->set("IC", "\033[%p1%d@");
|
||||
caps->set("ce", "\033[K");
|
||||
|
@ -114,7 +114,7 @@ int __attribute__((weak)) tgetnum(char const* id)
|
|||
static Vector<char> s_tgoto_buffer;
|
||||
char* __attribute__((weak)) tgoto([[maybe_unused]] char const* cap, [[maybe_unused]] int col, [[maybe_unused]] int row)
|
||||
{
|
||||
auto cap_str = StringView { cap, strlen(cap) }.replace("%p1%d"sv, String::number(col), ReplaceMode::FirstOnly).replace("%p2%d"sv, String::number(row), ReplaceMode::FirstOnly);
|
||||
auto cap_str = StringView { cap, strlen(cap) }.replace("%p1%d"sv, DeprecatedString::number(col), ReplaceMode::FirstOnly).replace("%p2%d"sv, DeprecatedString::number(row), ReplaceMode::FirstOnly);
|
||||
|
||||
s_tgoto_buffer.clear_with_capacity();
|
||||
s_tgoto_buffer.ensure_capacity(cap_str.length());
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/DateConstants.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Time.h>
|
||||
#include <Kernel/API/TimePage.h>
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/ScopedValueRollback.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/API/Unveil.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -189,12 +189,12 @@ int execvpe(char const* filename, char* const argv[], char* const envp[])
|
|||
ScopedValueRollback errno_rollback(errno);
|
||||
|
||||
// TODO: Make this use the PATH search implementation from Core::File.
|
||||
String path = getenv("PATH");
|
||||
DeprecatedString path = getenv("PATH");
|
||||
if (path.is_empty())
|
||||
path = DEFAULT_PATH;
|
||||
auto parts = path.split(':');
|
||||
for (auto& part : parts) {
|
||||
auto candidate = String::formatted("{}/{}", part, filename);
|
||||
auto candidate = DeprecatedString::formatted("{}/{}", part, filename);
|
||||
int rc = execve(candidate.characters(), argv, envp);
|
||||
if (rc < 0 && errno != ENOENT) {
|
||||
errno_rollback.set_override_rollback_value(errno);
|
||||
|
@ -854,13 +854,13 @@ void sync()
|
|||
syscall(SC_sync);
|
||||
}
|
||||
|
||||
static String getlogin_buffer;
|
||||
static DeprecatedString getlogin_buffer;
|
||||
|
||||
char* getlogin()
|
||||
{
|
||||
if (getlogin_buffer.is_null()) {
|
||||
if (auto* passwd = getpwuid(getuid())) {
|
||||
getlogin_buffer = String(passwd->pw_name);
|
||||
getlogin_buffer = DeprecatedString(passwd->pw_name);
|
||||
}
|
||||
endpwent();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue