[PATCH 2/4] Add a helper to check for error handler being set

Nikolay Sivov nsivov at codeweavers.com
Thu Oct 28 16:04:44 CDT 2010


---
 dlls/msxml3/saxreader.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c
index 3a2e534..1fdf48d 100644
--- a/dlls/msxml3/saxreader.c
+++ b/dlls/msxml3/saxreader.c
@@ -132,6 +132,12 @@ static inline BOOL has_content_handler(const saxlocator *locator)
            (!locator->vbInterface && locator->saxreader->contentHandler);
 }
 
+static inline BOOL has_error_handler(const saxlocator *locator)
+{
+    return (locator->vbInterface && locator->saxreader->vberrorHandler) ||
+          (!locator->vbInterface && locator->saxreader->errorHandler);
+}
+
 static HRESULT namespacePush(saxlocator *locator, int ns)
 {
     if(locator->nsStackLast>=locator->nsStackSize)
@@ -202,8 +208,7 @@ static void format_error_message_from_id(saxlocator *This, HRESULT hr)
     xmlStopParser(This->pParserCtxt);
     This->ret = hr;
 
-    if((This->vbInterface && This->saxreader->vberrorHandler)
-            || (!This->vbInterface && This->saxreader->errorHandler))
+    if(has_error_handler(This))
     {
         WCHAR msg[1024];
         if(!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM,
@@ -1299,8 +1304,7 @@ static void libxmlFatalError(void *ctx, const char *msg, ...)
     DWORD len;
     va_list args;
 
-    if((This->vbInterface && !This->saxreader->vberrorHandler)
-            || (!This->vbInterface && !This->saxreader->errorHandler))
+    if(!has_error_handler(This))
     {
         xmlStopParser(This->pParserCtxt);
         This->ret = E_FAIL;
-- 
1.5.6.5



--------------060606060800010500080202--



More information about the wine-patches mailing list