ソースを参照

LibCore: Remove now-unused Core::System::*env() functions

These have been moved to Core::Environment.
Sam Atkins 1 年間 前
コミット
56b8e248a5
2 ファイル変更0 行追加46 行削除
  1. 0 43
      Userland/Libraries/LibCore/System.cpp
  2. 0 3
      Userland/Libraries/LibCore/System.h

+ 0 - 43
Userland/Libraries/LibCore/System.cpp

@@ -1623,49 +1623,6 @@ ErrorOr<void> mkfifo(StringView pathname, mode_t mode)
     return mknod(pathname, mode | S_IFIFO, 0);
 }
 
-ErrorOr<void> setenv(StringView name, StringView value, bool overwrite)
-{
-    auto builder = TRY(StringBuilder::create());
-    TRY(builder.try_append(name));
-    TRY(builder.try_append('\0'));
-    TRY(builder.try_append(value));
-    TRY(builder.try_append('\0'));
-    // Note the explicit null terminators above.
-    auto c_name = builder.string_view().characters_without_null_termination();
-    auto c_value = c_name + name.length() + 1;
-    auto rc = ::setenv(c_name, c_value, overwrite);
-    if (rc < 0)
-        return Error::from_errno(errno);
-    return {};
-}
-
-ErrorOr<void> unsetenv(StringView name)
-{
-    auto builder = TRY(StringBuilder::create());
-    TRY(builder.try_append(name));
-    TRY(builder.try_append('\0'));
-
-    // Note the explicit null terminator above.
-    auto rc = ::unsetenv(builder.string_view().characters_without_null_termination());
-    if (rc < 0)
-        return Error::from_errno(errno);
-    return {};
-}
-
-ErrorOr<void> putenv(StringView env)
-{
-#ifdef AK_OS_SERENITY
-    auto rc = serenity_putenv(env.characters_without_null_termination(), env.length());
-#else
-    // Leak somewhat unavoidable here due to the putenv API.
-    auto leaked_new_env = strndup(env.characters_without_null_termination(), env.length());
-    auto rc = ::putenv(leaked_new_env);
-#endif
-    if (rc < 0)
-        return Error::from_errno(errno);
-    return {};
-}
-
 ErrorOr<int> posix_openpt(int flags)
 {
     int const rc = ::posix_openpt(flags);

+ 0 - 3
Userland/Libraries/LibCore/System.h

@@ -228,9 +228,6 @@ ErrorOr<Vector<gid_t>> getgroups();
 ErrorOr<void> setgroups(ReadonlySpan<gid_t>);
 ErrorOr<void> mknod(StringView pathname, mode_t mode, dev_t dev);
 ErrorOr<void> mkfifo(StringView pathname, mode_t mode);
-ErrorOr<void> setenv(StringView, StringView, bool);
-ErrorOr<void> unsetenv(StringView);
-ErrorOr<void> putenv(StringView);
 ErrorOr<int> posix_openpt(int flags);
 ErrorOr<void> grantpt(int fildes);
 ErrorOr<void> unlockpt(int fildes);