summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2021-11-08 14:15:13 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-12-15 13:09:49 +0330
commitdea86f511ce685be9639c3002e8b3d5c904713f2 (patch)
treead1b8a49bb1f831f5664c77be0fbac2ff3b18ab6 /Userland
parentceb0e28ea59db1003beb3f455255cf9394cb3027 (diff)
downloadserenity-dea86f511ce685be9639c3002e8b3d5c904713f2.zip
LibC: Use FlatPtr for malloced char* address storage
This would break with the next commit, after which char* will always be treated as c-strings.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibC/stdlib.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp
index 7ccd0fcff6..663682acb8 100644
--- a/Userland/Libraries/LibC/stdlib.cpp
+++ b/Userland/Libraries/LibC/stdlib.cpp
@@ -222,14 +222,14 @@ void abort()
_abort();
}
-static HashTable<const char*> s_malloced_environment_variables;
+static HashTable<FlatPtr> s_malloced_environment_variables;
static void free_environment_variable_if_needed(const char* var)
{
- if (!s_malloced_environment_variables.contains(var))
+ if (!s_malloced_environment_variables.contains((FlatPtr)var))
return;
free(const_cast<char*>(var));
- s_malloced_environment_variables.remove(var);
+ s_malloced_environment_variables.remove((FlatPtr)var);
}
char* getenv(const char* name)
@@ -304,7 +304,7 @@ int setenv(const char* name, const char* value, int overwrite)
auto length = strlen(name) + strlen(value) + 2;
auto* var = (char*)malloc(length);
snprintf(var, length, "%s=%s", name, value);
- s_malloced_environment_variables.set(var);
+ s_malloced_environment_variables.set((FlatPtr)var);
return putenv(var);
}