Skip to content

Commit

Permalink
Remove more bits of const for file handles from DLClose\DLSym
Browse files Browse the repository at this point in the history
  • Loading branch information
fsfod committed Jan 16, 2024
1 parent a15a90f commit 146cd32
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Interpreter/Paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ void* DLOpen(const std::string& Path, std::string* Err /* = nullptr */) {
}

void* DLSym(const std::string& Name, std::string* Err /* = nullptr*/) {
if (const void* Self = ::dlopen(nullptr, RTLD_GLOBAL)) {
if (void* Self = ::dlopen(nullptr, RTLD_GLOBAL)) {

Check warning on line 121 in lib/Interpreter/Paths.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/Paths.cpp#L120-L121

Added lines #L120 - L121 were not covered by tests
// get dlopen error if there is one
DLErr(Err);
const void* Sym = ::dlsym(const_cast<void*>(Self), Name.c_str());
void* Sym = ::dlsym(Self, Name.c_str());

Check warning on line 124 in lib/Interpreter/Paths.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/Paths.cpp#L124

Added line #L124 was not covered by tests
// overwrite error if dlsym caused one
DLErr(Err);
// only get dlclose error if dlopen & dlsym haven't emited one
Expand All @@ -132,8 +132,8 @@ void* DLSym(const std::string& Name, std::string* Err /* = nullptr*/) {
return nullptr;
}

void DLClose(const void* Lib, std::string* Err /* = nullptr*/) {
::dlclose(const_cast<void*>(Lib));
void DLClose(void* Lib, std::string* Err /* = nullptr*/) {
::dlclose(Lib);

Check warning on line 136 in lib/Interpreter/Paths.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/Paths.cpp#L135-L136

Added lines #L135 - L136 were not covered by tests
DLErr(Err);
}
#elif defined(_WIN32)
Expand Down

0 comments on commit 146cd32

Please sign in to comment.