Skip to content

Commit

Permalink
The static loader should not use a pointer
Browse files Browse the repository at this point in the history
Make `_wpe_loader_interface` into an external instance of `wpe_loader_interface`. Using a pointer is incorrect for this case where libwpe is compiled into the larger backend.
  • Loading branch information
donny-dont authored and aperezdc committed May 17, 2023
1 parent 960c111 commit d7c669c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/loader-static.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <stdio.h>
#include <stdlib.h>

extern struct wpe_loader_interface* _wpe_loader_interface;
extern struct wpe_loader_interface _wpe_loader_interface;

bool
wpe_loader_init(const char* impl_library_name)
Expand All @@ -50,13 +50,11 @@ wpe_loader_get_loaded_implementation_library_name(void)
void*
wpe_load_object(const char* object_name)
{
if (_wpe_loader_interface) {
if (!_wpe_loader_interface->load_object) {
fprintf(stderr, "wpe_load_object: failed to load object with name '%s': backend doesn't implement load_object vfunc\n", object_name);
abort();
}
return _wpe_loader_interface->load_object(object_name);
if (!_wpe_loader_interface.load_object) {
fprintf(stderr,
"wpe_load_object: failed to load object with name '%s': backend doesn't implement load_object vfunc\n",
object_name);
abort();
}

return NULL;
return _wpe_loader_interface.load_object(object_name);
}

0 comments on commit d7c669c

Please sign in to comment.