diff options
author | Lenny Maiorani <lenny@colorado.edu> | 2021-05-17 16:52:33 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-18 08:07:21 +0200 |
commit | 31d24d829258cf8f52b697dcefff02eae2029bcd (patch) | |
tree | 39240c83d48c240c8778139354f05a492641fdca | |
parent | 44a9c7c23e223c464d5d4a15c93c9fc7ab8525f0 (diff) | |
download | serenity-31d24d829258cf8f52b697dcefff02eae2029bcd.zip |
LibC: Remove static from function local constexpr variable
Problem:
- Function local `constexpr` variables do not need to be
`static`. This consumes memory which is unnecessary and can prevent
some optimizations.
Solution:
- Remove `static` keyword.
-rw-r--r-- | Userland/Libraries/LibC/stdlib.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/mktemp.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index 1e66630927..0406462959 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -165,7 +165,7 @@ inline int generate_unique_filename(char* pattern, Callback callback) size_t start = length - 6; - static constexpr char random_characters[] = "abcdefghijklmnopqrstuvwxyz0123456789"; + constexpr char random_characters[] = "abcdefghijklmnopqrstuvwxyz0123456789"; for (int attempt = 0; attempt < 100; ++attempt) { for (int i = 0; i < 6; ++i) diff --git a/Userland/Utilities/mktemp.cpp b/Userland/Utilities/mktemp.cpp index d40f8c5d1e..c1d1f98449 100644 --- a/Userland/Utilities/mktemp.cpp +++ b/Userland/Utilities/mktemp.cpp @@ -21,7 +21,7 @@ static char* generate_random_filename(const char* pattern) char* new_filename = strdup(pattern); int pattern_length = strlen(pattern); - static constexpr char random_characters[] = "abcdefghijklmnopqrstuvwxyz0123456789"; + constexpr char random_characters[] = "abcdefghijklmnopqrstuvwxyz0123456789"; for (auto i = pattern_length - 1; i >= 0; --i) { if (pattern[i] != 'X') break; |