BufferQueue: check before tracing buffer index

This change adds a check on ATRACE_ENABLED before calling snprintf to trace the
buffer index.

Change-Id: Id79430f9c69706393efd3d10780a4cc97055e9e0
This commit is contained in:
Jamie Gennis 2012-04-16 20:34:58 -07:00
parent 91a6826d67
commit 695e331f01

View File

@ -57,9 +57,12 @@
#define ST_LOGE(x, ...) ALOGE("[%s] "x, mConsumerName.string(), ##__VA_ARGS__)
#define ATRACE_BUFFER_INDEX(index) \
if (ATRACE_ENABLED()) { \
char ___traceBuf[1024]; \
snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), (index)); \
android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf);
snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), \
(index)); \
android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); \
}
namespace android {