From 3a2fa18744127618c5a6715ff1e24f18c9f9dd49 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 2 Sep 2011 02:00:37 -0700 Subject: Log the function name instead of the source file and line number --- Alc/ALc.c | 22 ++++++++++++---------- Alc/helpers.c | 10 ++-------- Alc/hrtf.c | 2 +- OpenAL32/Include/alMain.h | 5 ++--- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index deeab0dd..5cc4a777 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1344,16 +1344,18 @@ static ALvoid InitContext(ALCcontext *pContext) */ static ALCvoid FreeContext(ALCcontext *context) { + TRACE("%p\n", context); + if(context->SourceMap.size > 0) { - ERR("FreeContext(%p): deleting %d Source(s)\n", context, context->SourceMap.size); + ERR("(%p) Deleting %d Source(s)\n", context, context->SourceMap.size); ReleaseALSources(context); } ResetUIntMap(&context->SourceMap); if(context->EffectSlotMap.size > 0) { - ERR("FreeContext(%p): deleting %d AuxiliaryEffectSlot(s)\n", context, context->EffectSlotMap.size); + ERR("(%p) Deleting %d AuxiliaryEffectSlot(s)\n", context, context->EffectSlotMap.size); ReleaseALAuxiliaryEffectSlots(context); } ResetUIntMap(&context->EffectSlotMap); @@ -1377,14 +1379,14 @@ void ALCcontext_IncRef(ALCcontext *context) { RefCount ref; ref = IncrementRef(&context->ref); - TRACE("%p refcount increment to %d\n", context, ref); + TRACE("%p increasing refcount to %u\n", context, ref); } void ALCcontext_DecRef(ALCcontext *context) { RefCount ref; ref = DecrementRef(&context->ref); - TRACE("%p refcount decrement to %d\n", context, ref); + TRACE("%p decreasing refcount to %u\n", context, ref); if(ref == 0) FreeContext(context); } @@ -2537,7 +2539,7 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *pDevice) if(pDevice->NumContexts > 0) { - WARN("alcCloseDevice(): destroying %u Context(s)\n", pDevice->NumContexts); + WARN("Destroying %u Context(s)\n", pDevice->NumContexts); while(pDevice->ContextList) alcDestroyContext(pDevice->ContextList); } @@ -2545,21 +2547,21 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *pDevice) if(pDevice->BufferMap.size > 0) { - WARN("alcCloseDevice(): deleting %d Buffer(s)\n", pDevice->BufferMap.size); + WARN("Deleting %d Buffer(s)\n", pDevice->BufferMap.size); ReleaseALBuffers(pDevice); } ResetUIntMap(&pDevice->BufferMap); if(pDevice->EffectMap.size > 0) { - WARN("alcCloseDevice(): deleting %d Effect(s)\n", pDevice->EffectMap.size); + WARN("Deleting %d Effect(s)\n", pDevice->EffectMap.size); ReleaseALEffects(pDevice); } ResetUIntMap(&pDevice->EffectMap); if(pDevice->FilterMap.size > 0) { - WARN("alcCloseDevice(): deleting %d Filter(s)\n", pDevice->FilterMap.size); + WARN("Deleting %d Filter(s)\n", pDevice->FilterMap.size); ReleaseALFilters(pDevice); } ResetUIntMap(&pDevice->FilterMap); @@ -2703,7 +2705,7 @@ static void ReleaseALC(ALCboolean doclose) if(doclose) { if(g_ulDeviceCount > 0) - WARN("ReleaseALC(): closing %u Device%s\n", g_ulDeviceCount, (g_ulDeviceCount>1)?"s":""); + WARN("Closing %u device%s\n", g_ulDeviceCount, (g_ulDeviceCount>1)?"s":""); while(g_pDeviceList) { @@ -2716,7 +2718,7 @@ static void ReleaseALC(ALCboolean doclose) else { if(g_ulDeviceCount > 0) - WARN("ReleaseALC(): %u Device%s not closed\n", g_ulDeviceCount, (g_ulDeviceCount>1)?"s":""); + WARN("%u device%s not closed\n", g_ulDeviceCount, (g_ulDeviceCount>1)?"s":""); } } diff --git a/Alc/helpers.c b/Alc/helpers.c index fab8209a..cd51912c 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -207,18 +207,12 @@ void *GetSymbol(void *handle, const char *name) #endif -void al_print(const char *fname, unsigned int line, const char *fmt, ...) +void al_print(const char *func, const char *fmt, ...) { - const char *fn; char str[256]; int i; - fn = strrchr(fname, '/'); - if(!fn) fn = strrchr(fname, '\\'); - if(!fn) fn = fname; - else fn += 1; - - i = snprintf(str, sizeof(str), "AL lib: %s:%d: ", fn, line); + i = snprintf(str, sizeof(str), "AL lib: %s: ", func); if(i < (int)sizeof(str) && i > 0) { va_list ap; diff --git a/Alc/hrtf.c b/Alc/hrtf.c index 344b826b..de6d5953 100644 --- a/Alc/hrtf.c +++ b/Alc/hrtf.c @@ -291,7 +291,7 @@ ALCboolean IsHrtfCompatible(ALCdevice *device) { if(device->FmtChans == DevFmtStereo && device->Frequency == Hrtf.sampleRate) return ALC_TRUE; - ERR("Incompatible HRTF format: %s %uhz (%s %uhz needed)\n", + ERR("format: %s %uhz (needed: %s %uhz)\n", DevFmtChannelsString(device->FmtChans), device->Frequency, DevFmtChannelsString(DevFmtStereo), Hrtf.sampleRate); return ALC_FALSE; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 564730c4..ae24f54c 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -674,9 +674,8 @@ ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], void GetLerpedHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays); ALuint GetMovingHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat delta, ALint counter, ALfloat (*coeffs)[2], ALuint *delays, ALfloat (*coeffStep)[2], ALint *delayStep); -void al_print(const char *fname, unsigned int line, const char *fmt, ...) - PRINTF_STYLE(3,4); -#define AL_PRINT(...) al_print(__FILE__, __LINE__, __VA_ARGS__) +void al_print(const char *func, const char *fmt, ...) PRINTF_STYLE(2,3); +#define AL_PRINT(...) al_print(__FUNCTION__, __VA_ARGS__) extern FILE *LogFile; enum LogLevel { -- cgit v1.2.3