From 89eb7bdcad092821b61a48832e1db82975a2252b Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 19 Jun 2013 13:59:40 +0100 Subject: [PATCH] hw/xwin: Remove setjmp()/longjmp() error constants Check specially that setjmp() returned a value which we don't pass to longjmp() seems a bit over-complex. Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winclipboard/internal.h | 2 -- hw/xwin/winclipboard/thread.c | 13 ++----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/hw/xwin/winclipboard/internal.h b/hw/xwin/winclipboard/internal.h index 34563e170..4b3531ad6 100644 --- a/hw/xwin/winclipboard/internal.h +++ b/hw/xwin/winclipboard/internal.h @@ -38,8 +38,6 @@ /* Windows headers */ #include -#define WIN_JMP_OKAY 0 -#define WIN_JMP_ERROR_IO 2 #define WIN_XEVENTS_SUCCESS 0 #define WIN_XEVENTS_CONVERT 2 #define WIN_XEVENTS_NOTIFY 3 diff --git a/hw/xwin/winclipboard/thread.c b/hw/xwin/winclipboard/thread.c index 72d56d5e1..8f0ede5c8 100644 --- a/hw/xwin/winclipboard/thread.c +++ b/hw/xwin/winclipboard/thread.c @@ -135,16 +135,7 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay) XSetIOErrorHandler(winClipboardIOErrorHandler); /* Set jump point for Error exits */ - iReturn = setjmp(g_jmpEntry); - - /* Check if we should continue operations */ - if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) { - /* setjmp returned an unknown value, exit */ - ErrorF("winClipboardProc - setjmp returned: %d exiting\n", iReturn); - goto winClipboardProc_Exit; - } - else if (iReturn == WIN_JMP_ERROR_IO) { - /* TODO: Cleanup the Win32 window and free any allocated memory */ + if (setjmp(g_jmpEntry)) { ErrorF("winClipboardProc - setjmp returned for IO Error Handler.\n"); goto winClipboardProc_Done; } @@ -483,7 +474,7 @@ winClipboardIOErrorHandler(Display * pDisplay) if (pthread_equal(pthread_self(), g_winClipboardProcThread)) { /* Restart at the main entry point */ - longjmp(g_jmpEntry, WIN_JMP_ERROR_IO); + longjmp(g_jmpEntry, 2); } if (g_winClipboardOldIOErrorHandler)