reformat code

This commit is contained in:
sasha0552 2024-06-27 07:36:08 +00:00 committed by GitHub
parent 2432c6fbdf
commit 720de00eb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;