diff options
author | Tim Schumacher <timschumi@gmx.de> | 2022-08-14 13:08:17 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-05 10:12:02 +0100 |
commit | be941c13e3da77149283c76711743c4b127a9907 (patch) | |
tree | cb969543f028e63212d2e137185dadcb9b80bf4d /Userland/Libraries/LibC | |
parent | 39477e923fcee76742741886944e507d09bc4459 (diff) | |
download | serenity-be941c13e3da77149283c76711743c4b127a9907.zip |
LibC: Reduce reliance on the dlfcn internals for `regex` functions
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r-- | Userland/Libraries/LibC/regex.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Userland/Libraries/LibC/regex.cpp b/Userland/Libraries/LibC/regex.cpp index f4ed51fc93..8bc2d3f92d 100644 --- a/Userland/Libraries/LibC/regex.cpp +++ b/Userland/Libraries/LibC/regex.cpp @@ -6,7 +6,6 @@ #include <AK/Assertions.h> #include <dlfcn.h> -#include <dlfcn_integration.h> #include <pthread.h> #include <regex.h> @@ -22,12 +21,20 @@ static void ensure_libregex() { pthread_mutex_lock(&s_libregex_lock); if (!s_libregex) { - s_libregex = __dlopen("libregex.so", RTLD_NOW).value(); + s_libregex = dlopen("libregex.so", RTLD_NOW); + VERIFY(s_libregex); - s_regcomp = reinterpret_cast<int (*)(regex_t*, char const*, int)>(__dlsym(s_libregex, "regcomp").value()); - s_regexec = reinterpret_cast<int (*)(regex_t const*, char const*, size_t, regmatch_t[], int)>(__dlsym(s_libregex, "regexec").value()); - s_regerror = reinterpret_cast<size_t (*)(int, regex_t const*, char*, size_t)>(__dlsym(s_libregex, "regerror").value()); - s_regfree = reinterpret_cast<void (*)(regex_t*)>(__dlsym(s_libregex, "regfree").value()); + s_regcomp = reinterpret_cast<int (*)(regex_t*, char const*, int)>(dlsym(s_libregex, "regcomp")); + VERIFY(s_regcomp); + + s_regexec = reinterpret_cast<int (*)(regex_t const*, char const*, size_t, regmatch_t[], int)>(dlsym(s_libregex, "regexec")); + VERIFY(s_regexec); + + s_regerror = reinterpret_cast<size_t (*)(int, regex_t const*, char*, size_t)>(dlsym(s_libregex, "regerror")); + VERIFY(s_regerror); + + s_regfree = reinterpret_cast<void (*)(regex_t*)>(dlsym(s_libregex, "regfree")); + VERIFY(s_regerror); } pthread_mutex_unlock(&s_libregex_lock); } |