Skip to content

Commit d7c669c

Browse files
donny-dontaperezdc
authored andcommitted
The static loader should not use a pointer
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.
1 parent 960c111 commit d7c669c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/loader-static.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <stdio.h>
3030
#include <stdlib.h>
3131

32-
extern struct wpe_loader_interface* _wpe_loader_interface;
32+
extern struct wpe_loader_interface _wpe_loader_interface;
3333

3434
bool
3535
wpe_loader_init(const char* impl_library_name)
@@ -50,13 +50,11 @@ wpe_loader_get_loaded_implementation_library_name(void)
5050
void*
5151
wpe_load_object(const char* object_name)
5252
{
53-
if (_wpe_loader_interface) {
54-
if (!_wpe_loader_interface->load_object) {
55-
fprintf(stderr, "wpe_load_object: failed to load object with name '%s': backend doesn't implement load_object vfunc\n", object_name);
56-
abort();
57-
}
58-
return _wpe_loader_interface->load_object(object_name);
53+
if (!_wpe_loader_interface.load_object) {
54+
fprintf(stderr,
55+
"wpe_load_object: failed to load object with name '%s': backend doesn't implement load_object vfunc\n",
56+
object_name);
57+
abort();
5958
}
60-
61-
return NULL;
59+
return _wpe_loader_interface.load_object(object_name);
6260
}

0 commit comments

Comments
 (0)