Nikolay Sivov : msxml3: Use static buffer when tracing libxml2 error messages.
Alexandre Julliard
julliard at winehq.org
Thu Feb 16 13:10:46 CST 2012
Module: wine
Branch: master
Commit: 1dab61125ee0ffaac14c142828ec06310050fa89
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1dab61125ee0ffaac14c142828ec06310050fa89
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Feb 16 20:01:07 2012 +0300
msxml3: Use static buffer when tracing libxml2 error messages.
---
dlls/msxml3/main.c | 27 +++++++++------------------
1 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/dlls/msxml3/main.c b/dlls/msxml3/main.c
index 464ef90..e01d331 100644
--- a/dlls/msxml3/main.c
+++ b/dlls/msxml3/main.c
@@ -62,9 +62,11 @@ HINSTANCE MSXML_hInstance = NULL;
void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap)
{
- char* buf = NULL;
- int len = 32, needed;
- enum __wine_debug_class dbcl = __WINE_DBCL_ERR;
+ static const int max_size = 200;
+ enum __wine_debug_class dbcl;
+ char buff[max_size];
+ int len;
+
switch (lvl)
{
case XML_ERR_NONE:
@@ -74,25 +76,14 @@ void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg,
dbcl = __WINE_DBCL_WARN;
break;
default:
+ dbcl = __WINE_DBCL_ERR;
break;
}
- do
- {
- heap_free(buf);
- buf = heap_alloc(len);
- needed = vsnprintf(buf, len, msg, ap);
- if (needed == -1)
- len *= 2;
- else if (needed >= len)
- len = needed + 1;
- else
- needed = 0;
- }
- while (needed);
+ len = vsnprintf(buff, max_size, msg, ap);
+ if (len == -1 || len >= max_size) buff[max_size-1] = 0;
- wine_dbg_log(dbcl, &__wine_dbch_msxml, caller, "%s", buf);
- heap_free(buf);
+ wine_dbg_log(dbcl, &__wine_dbch_msxml, caller, "%s", buff);
}
void wineXmlCallbackError(char const* caller, xmlErrorPtr err)
More information about the wine-cvs
mailing list