aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-20 12:24:23 -0700
committerChris Robinson <[email protected]>2011-09-20 12:24:23 -0700
commite43470da7a590ab026006a4f35caaff134c21455 (patch)
tree7d1f594ab1b035c8f7b49a5f3982965afa6c9374
parentd3e7a26db6c51410147eeeee8113cd7eac5d9668 (diff)
Make a separate log level to trace reference counts, to avoid log spam for traces
-rw-r--r--Alc/ALc.c10
-rw-r--r--OpenAL32/Include/alMain.h8
2 files changed, 12 insertions, 6 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index ff7df305..b5ac29d1 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -566,7 +566,7 @@ static void alc_initconfig(void)
if(str)
{
long lvl = strtol(str, NULL, 0);
- if(lvl >= NoLog && lvl <= LogTrace)
+ if(lvl >= NoLog && lvl <= LogRef)
LogLevel = lvl;
}
@@ -1298,14 +1298,14 @@ void ALCdevice_IncRef(ALCdevice *device)
{
RefCount ref;
ref = IncrementRef(&device->ref);
- TRACE("%p increasing refcount to %u\n", device, ref);
+ TRACEREF("%p increasing refcount to %u\n", device, ref);
}
void ALCdevice_DecRef(ALCdevice *device)
{
RefCount ref;
ref = DecrementRef(&device->ref);
- TRACE("%p decreasing refcount to %u\n", device, ref);
+ TRACEREF("%p decreasing refcount to %u\n", device, ref);
if(ref == 0) FreeDevice(device);
}
@@ -1471,14 +1471,14 @@ void ALCcontext_IncRef(ALCcontext *context)
{
RefCount ref;
ref = IncrementRef(&context->ref);
- TRACE("%p increasing refcount to %u\n", context, ref);
+ TRACEREF("%p increasing refcount to %u\n", context, ref);
}
void ALCcontext_DecRef(ALCcontext *context)
{
RefCount ref;
ref = DecrementRef(&context->ref);
- TRACE("%p decreasing refcount to %u\n", context, ref);
+ TRACEREF("%p decreasing refcount to %u\n", context, ref);
if(ref == 0) FreeContext(context);
}
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 5ee90db6..719354f2 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -701,10 +701,16 @@ enum LogLevel {
NoLog,
LogError,
LogWarning,
- LogTrace
+ LogTrace,
+ LogRef
};
extern enum LogLevel LogLevel;
+#define TRACEREF(...) do { \
+ if(LogLevel >= LogRef) \
+ AL_PRINT(__VA_ARGS__); \
+} while(0)
+
#define TRACE(...) do { \
if(LogLevel >= LogTrace) \
AL_PRINT(__VA_ARGS__); \