From 2aab8716b2302c196349326a228e82b881d5fde3 Mon Sep 17 00:00:00 2001 From: Guillaume Denneulin Date: Tue, 3 Dec 2013 14:27:41 +0100 Subject: [core] Optimize log handling. BZ: 154623 When logging, the pfw was limited to 512 bytes. Remove this limitation and optimize the buffer allocated. Change-Id: I91537f30a519d93a4b1e55a23fe02f42dec3af8a Signed-off-by: Guillaume Denneulin --- parameter/SubsystemObject.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) mode change 100644 => 100755 parameter/SubsystemObject.cpp (limited to 'parameter/SubsystemObject.cpp') diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp old mode 100644 new mode 100755 index 8c4e187..eaf87aa --- a/parameter/SubsystemObject.cpp +++ b/parameter/SubsystemObject.cpp @@ -190,30 +190,34 @@ void CSubsystemObject::blackboardWrite(const void* pvData, uint32_t uiSize) // Logging void CSubsystemObject::log_info(const string& strMessage, ...) const { - char acBuffer[512]; + char *pacBuffer; va_list listPointer; va_start(listPointer, strMessage); - vsnprintf(acBuffer, sizeof(acBuffer), strMessage.c_str(), listPointer); + vasprintf(&pacBuffer, strMessage.c_str(), listPointer); va_end(listPointer); - _pInstanceConfigurableElement->log_info(acBuffer); + _pInstanceConfigurableElement->log_info(pacBuffer); + + free(pacBuffer); } void CSubsystemObject::log_warning(const string& strMessage, ...) const { - char acBuffer[512]; + char *pacBuffer; va_list listPointer; va_start(listPointer, strMessage); - vsnprintf(acBuffer, sizeof(acBuffer), strMessage.c_str(), listPointer); + vasprintf(&pacBuffer, strMessage.c_str(), listPointer); va_end(listPointer); - _pInstanceConfigurableElement->log_warning(acBuffer); + _pInstanceConfigurableElement->log_warning(pacBuffer); + + free(pacBuffer); } // Configurable element retrieval -- cgit v1.1