reformat code
This commit is contained in:
parent
2432c6fbdf
commit
720de00eb7
1 changed files with 58 additions and 67 deletions
|
@ -1,8 +1,5 @@
|
||||||
#include "nvapi.h"
|
#include "nvapi.h"
|
||||||
|
|
||||||
// TODO: remove
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <libloaderapi.h>
|
# include <libloaderapi.h>
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
|
@ -52,13 +49,9 @@ void nvapi_init() {
|
||||||
// lookup QueryInterface
|
// lookup QueryInterface
|
||||||
if (lib) {
|
if (lib) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!nvapi_QueryInterface) {
|
|
||||||
nvapi_QueryInterface = (nvapi_QueryInterface_t) GetProcAddress(lib, "nvapi_QueryInterface");
|
nvapi_QueryInterface = (nvapi_QueryInterface_t) GetProcAddress(lib, "nvapi_QueryInterface");
|
||||||
}
|
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
if (!nvapi_QueryInterface) {
|
|
||||||
nvapi_QueryInterface = (nvapi_QueryInterface_t) dlsym(lib, "nvapi_QueryInterface");
|
nvapi_QueryInterface = (nvapi_QueryInterface_t) dlsym(lib, "nvapi_QueryInterface");
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,15 +76,13 @@ void nvapi_free() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// free library
|
// free library
|
||||||
|
if (lib) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (lib) {
|
|
||||||
FreeLibrary(lib);
|
FreeLibrary(lib);
|
||||||
}
|
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
if (lib) {
|
|
||||||
dlclose(lib);
|
dlclose(lib);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// invalidate pointers
|
// invalidate pointers
|
||||||
lib = nullptr;
|
lib = nullptr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue