From: misomosi Date: Tue, 7 May 2024 02:38:55 +0000 (-0400) Subject: Fix to use PLDLOG X-Git-Url: http://git.misomosispi.com/?a=commitdiff_plain;h=f02824c9121c9e9d0c7fa251b1eb16ff0b6e5220;p=pldh.git Fix to use PLDLOG --- diff --git a/pld.h b/pld.h index 7c50c95..496b92a 100644 --- a/pld.h +++ b/pld.h @@ -15,6 +15,9 @@ static int PLD_Private_strlen(const char *s) return len - 1; } +#ifndef PLDLOG +#define PLDLOG(message, name, err) PLD_Private_Log(message, name, err) +#endif #ifdef _WIN32 @@ -46,7 +49,7 @@ static HMODULE PLD_Private_LoadLibrary_wrapper(LPCSTR lpLibFileName) if (hModule == NULL) hModule = LoadLibraryA(lpLibFileName); if (hModule == NULL) - PLD_Private_Log("Failed to load library!", lpLibFileName, GetLastError()); + PLDLOG("Failed to load library!", lpLibFileName, GetLastError()); return hModule; } @@ -54,7 +57,7 @@ static FARPROC PLD_Private_GetProcAddress_wrapper(HMODULE hModule, LPCSTR lpProc { FARPROC lpProc = GetProcAddress(hModule, lpProcName); if (lpProc == NULL) - PLD_Private_Log("Failed to load procedure!", lpProcName, GetLastError()); + PLDLOG("Failed to load procedure!", lpProcName, GetLastError()); return lpProc; } @@ -75,6 +78,7 @@ static FARPROC PLD_Private_GetProcAddress_wrapper(HMODULE hModule, LPCSTR lpProc #include #include #include + typedef intptr_t PLD_ErrCode; static void PLD_Private_Log(const char *, const char *, PLD_ErrCode); @@ -97,7 +101,7 @@ static void *PLD_Private_dlopen_wrapper(const char *name) if (handle == NULL) handle = dlopen(name, RTLD_LAZY); if (handle == NULL) - PLD_Private_Log("Failed to load library!", name, (intptr_t)dlerror()); + PLDLOG("Failed to load library!", name, (intptr_t)dlerror()); return handle; } @@ -105,7 +109,7 @@ static void *PLD_Private_dlsym_wrapper(void *handle, const char *name) { void *sym = dlsym(handle, name); if (sym == NULL) - PLD_Private_Log("Failed to load procedure!", name, (intptr_t)dlerror()); + PLDLOG("Failed to load procedure!", name, (intptr_t)dlerror()); return sym; } @@ -140,8 +144,4 @@ static void PLD_Private_Log(const char *message, const char *name, PLD_ErrCode e #endif } -#ifndef PLDLOG -#define PLDLOG(message, name, err) PLD_Private_Log(message, name, err) -#endif - #endif // COOL_PLD_H