gitlab-ci: enable sanitizers for the meson builds
[mesa-waffle.git] / src / waffle / api / waffle_dl.c
blob7d13dca62cb56cd09968a6ab81eaaa1452d3dd62
1 // SPDX-FileCopyrightText: Copyright 2012 Intel Corporation
2 // SPDX-License-Identifier: BSD-2-Clause
4 #include "api_priv.h"
6 #include "wcore_error.h"
7 #include "wcore_platform.h"
9 static bool
10 waffle_dl_check_enum(int32_t dl)
12 switch (dl) {
13 case WAFFLE_DL_OPENGL:
14 case WAFFLE_DL_OPENGL_ES1:
15 case WAFFLE_DL_OPENGL_ES2:
16 case WAFFLE_DL_OPENGL_ES3:
17 return true;
18 default:
19 wcore_errorf(WAFFLE_ERROR_BAD_PARAMETER, "dl has bad value %#x",
20 dl);
21 return false;
25 WAFFLE_API bool
26 waffle_dl_can_open(int32_t dl)
28 if (!api_check_entry(NULL, 0))
29 return false;
31 if (!waffle_dl_check_enum(dl))
32 return false;
34 return api_platform->vtbl->dl_can_open(api_platform, dl);
37 WAFFLE_API void*
38 waffle_dl_sym(int32_t dl, const char *name)
40 if (!api_check_entry(NULL, 0))
41 return NULL;
43 if (!waffle_dl_check_enum(dl))
44 return NULL;
46 return api_platform->vtbl->dl_sym(api_platform, dl, name);