Skip to content

Commit 5063e61

Browse files
committed
remove get_env_var function from this pull request
1 parent a1d1985 commit 5063e61

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

libc/src/time/time_utils.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -120,33 +120,6 @@ static int64_t computeRemainingYears(int64_t daysPerYears,
120120
return years;
121121
}
122122

123-
char *get_env_var(const char *input) {
124-
char **env_ptr = reinterpret_cast<char **>(LIBC_NAMESPACE::app.env_ptr);
125-
126-
if (input == nullptr || env_ptr == nullptr)
127-
return nullptr;
128-
129-
LIBC_NAMESPACE::cpp::string_view env_var_name(input);
130-
if (env_var_name.size() == 0)
131-
return nullptr;
132-
133-
for (char **env = env_ptr; *env != nullptr; ++env) {
134-
LIBC_NAMESPACE::cpp::string_view cur(*env);
135-
if (!cur.starts_with(env_var_name))
136-
continue;
137-
138-
if (cur[env_var_name.size()] != '=')
139-
continue;
140-
141-
// Remove the name and the equals sign.
142-
cur.remove_prefix(env_var_name.size() + 1);
143-
// We know that data is null terminated, so this is safe.
144-
return const_cast<char *>(cur.data());
145-
}
146-
147-
return nullptr;
148-
}
149-
150123
// First, divide "total_seconds" by the number of seconds in a day to get the
151124
// number of days since Jan 1 1970. The remainder will be used to calculate the
152125
// number of Hours, Minutes and Seconds.

libc/src/time/time_utils.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ cpp::optional<time_t> mktime_internal(const tm *tm_out);
3737
// "total_seconds" is the number of seconds since January 1st, 1970.
3838
int64_t update_from_seconds(time_t total_seconds, tm *tm);
3939

40-
#ifdef LIBC_TARGET_OS_IS_LINUX
41-
extern char *get_env_var(const char *var_name);
42-
#endif
43-
4440
// TODO(michaelrj): move these functions to use ErrorOr instead of setting
4541
// errno. They always accompany a specific return value so we only need the one
4642
// variable.

0 commit comments

Comments
 (0)