1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:27: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:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -221,7 +221,7 @@ void Service::spawn(int socket_fd)
setenv("HOME", account.home_directory().characters(), true);
}
for (String& env : m_environment)
for (DeprecatedString& env : m_environment)
putenv(const_cast<char*>(env.characters()));
char* argv[m_extra_arguments.size() + 2];
@ -281,11 +281,11 @@ Service::Service(Core::ConfigFile const& config, StringView name)
VERIFY(config.has_group(name));
set_name(name);
m_executable_path = config.read_entry(name, "Executable", String::formatted("/bin/{}", this->name()));
m_executable_path = config.read_entry(name, "Executable", DeprecatedString::formatted("/bin/{}", this->name()));
m_extra_arguments = config.read_entry(name, "Arguments", "").split(' ');
m_stdio_file_path = config.read_entry(name, "StdIO");
String prio = config.read_entry(name, "Priority");
DeprecatedString prio = config.read_entry(name, "Priority");
if (prio == "low")
m_priority = 10;
else if (prio == "normal" || prio.is_null())
@ -313,12 +313,12 @@ Service::Service(Core::ConfigFile const& config, StringView name)
m_multi_instance = config.read_bool_entry(name, "MultiInstance");
m_accept_socket_connections = config.read_bool_entry(name, "AcceptSocketConnections");
String socket_entry = config.read_entry(name, "Socket");
String socket_permissions_entry = config.read_entry(name, "SocketPermissions", "0600");
DeprecatedString socket_entry = config.read_entry(name, "Socket");
DeprecatedString socket_permissions_entry = config.read_entry(name, "SocketPermissions", "0600");
if (!socket_entry.is_null()) {
Vector<String> socket_paths = socket_entry.split(',');
Vector<String> socket_perms = socket_permissions_entry.split(',');
Vector<DeprecatedString> socket_paths = socket_entry.split(',');
Vector<DeprecatedString> socket_perms = socket_permissions_entry.split(',');
m_sockets.ensure_capacity(socket_paths.size());
// Need i here to iterate along with all other vectors.
@ -409,7 +409,7 @@ void Service::save_to(JsonObject& json)
bool Service::is_enabled() const
{
extern String g_system_mode;
extern DeprecatedString g_system_mode;
return m_system_modes.contains_slow(g_system_mode);
}

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <LibCore/Account.h>
#include <LibCore/ElapsedTimer.h>
#include <LibCore/Notifier.h>
@ -40,7 +40,7 @@ private:
/// requested by a service.
struct SocketDescriptor {
/// The path of the socket.
String path;
DeprecatedString path;
/// File descriptor of the socket. -1 if the socket hasn't been opened.
int fd { -1 };
/// File permissions of the socket.
@ -48,11 +48,11 @@ private:
};
// Path to the executable. By default this is /bin/{m_name}.
String m_executable_path;
DeprecatedString m_executable_path;
// Extra arguments, starting from argv[1], to pass when exec'ing.
Vector<String> m_extra_arguments;
Vector<DeprecatedString> m_extra_arguments;
// File path to open as stdio fds.
String m_stdio_file_path;
DeprecatedString m_stdio_file_path;
int m_priority { 1 };
// Whether we should re-launch it if it exits.
bool m_keep_alive { false };
@ -63,15 +63,15 @@ private:
// Whether we should only spawn this service once somebody connects to the socket.
bool m_lazy;
// The name of the user we should run this service as.
String m_user;
DeprecatedString m_user;
// The working directory in which to spawn the service.
String m_working_directory;
DeprecatedString m_working_directory;
// System modes in which to run this service. By default, this is the graphical mode.
Vector<String> m_system_modes;
Vector<DeprecatedString> m_system_modes;
// Whether several instances of this service can run at once.
bool m_multi_instance { false };
// Environment variables to pass to the service.
Vector<String> m_environment;
Vector<DeprecatedString> m_environment;
// Socket descriptors for this service.
Vector<SocketDescriptor> m_sockets;

View file

@ -29,7 +29,7 @@
#include <sys/wait.h>
#include <unistd.h>
String g_system_mode = "graphical";
DeprecatedString g_system_mode = "graphical";
NonnullRefPtrVector<Service> g_services;
// NOTE: This handler ensures that the destructor of g_services is called.
@ -76,7 +76,7 @@ static ErrorOr<void> determine_system_mode()
// Continue and assume "text" mode.
return {};
}
const String system_mode = String::copy(f->read_all(), Chomp);
const DeprecatedString system_mode = DeprecatedString::copy(f->read_all(), Chomp);
if (f->error()) {
dbgln("Failed to read system_mode: {}", f->error_string());
// Continue and assume "text" mode.
@ -142,13 +142,13 @@ inline char offset_character_with_number(char base_char, u8 offset)
return offsetted_char;
}
static void create_devtmpfs_block_device(String name, mode_t mode, unsigned major, unsigned minor)
static void create_devtmpfs_block_device(DeprecatedString name, mode_t mode, unsigned major, unsigned minor)
{
if (auto rc = mknod(name.characters(), mode | S_IFBLK, makedev(major, minor)); rc < 0)
VERIFY_NOT_REACHED();
}
static void create_devtmpfs_char_device(String name, mode_t mode, unsigned major, unsigned minor)
static void create_devtmpfs_char_device(DeprecatedString name, mode_t mode, unsigned major, unsigned minor)
{
if (auto rc = mknod(name.characters(), mode | S_IFCHR, makedev(major, minor)); rc < 0)
VERIFY_NOT_REACHED();
@ -203,22 +203,22 @@ static void populate_devtmpfs_devices_based_on_devctl()
switch (major_number) {
case 116: {
if (!is_block_device) {
create_devtmpfs_char_device(String::formatted("/dev/audio/{}", minor_number), 0220, 116, minor_number);
create_devtmpfs_char_device(DeprecatedString::formatted("/dev/audio/{}", minor_number), 0220, 116, minor_number);
break;
}
break;
}
case 28: {
create_devtmpfs_block_device(String::formatted("/dev/gpu/render{}", minor_number), 0666, 28, minor_number);
create_devtmpfs_block_device(DeprecatedString::formatted("/dev/gpu/render{}", minor_number), 0666, 28, minor_number);
break;
}
case 226: {
create_devtmpfs_char_device(String::formatted("/dev/gpu/connector{}", minor_number), 0666, 226, minor_number);
create_devtmpfs_char_device(DeprecatedString::formatted("/dev/gpu/connector{}", minor_number), 0666, 226, minor_number);
break;
}
case 229: {
if (!is_block_device) {
create_devtmpfs_char_device(String::formatted("/dev/hvc0p{}", minor_number), 0666, major_number, minor_number);
create_devtmpfs_char_device(DeprecatedString::formatted("/dev/hvc0p{}", minor_number), 0666, major_number, minor_number);
}
break;
}
@ -284,13 +284,13 @@ static void populate_devtmpfs_devices_based_on_devctl()
}
case 30: {
if (!is_block_device) {
create_devtmpfs_char_device(String::formatted("/dev/kcov{}", minor_number), 0666, 30, minor_number);
create_devtmpfs_char_device(DeprecatedString::formatted("/dev/kcov{}", minor_number), 0666, 30, minor_number);
}
break;
}
case 3: {
if (is_block_device) {
create_devtmpfs_block_device(String::formatted("/dev/hd{}", offset_character_with_number('a', minor_number)), 0600, 3, minor_number);
create_devtmpfs_block_device(DeprecatedString::formatted("/dev/hd{}", offset_character_with_number('a', minor_number)), 0600, 3, minor_number);
}
break;
}