From: Darren S. <li...@yo...> - 2010-07-18 12:03:17
|
# HG changeset patch # User Darren Salt <li...@yo...> # Date 1279454530 -3600 # Node ID 5ef9ce9770c663657e0d182c3d4441a460cb0abd # Parent 07e67ed0a9719dc3769bb29b0641d9bd11fcbe13 Fix XLOCK and XUNLOCK macros wrt block structure. diff --git a/src/xitk/xine-toolkit/widget.h b/src/xitk/xine-toolkit/widget.h --- a/src/xitk/xine-toolkit/widget.h +++ b/src/xitk/xine-toolkit/widget.h @@ -137,7 +137,7 @@ #if 1 static int displ; -#define XLOCK(DISP) { \ +#define XLOCK(DISP) do { \ int i; \ displ++; \ for(i = 0; i < displ; i++) printf("%d",i); \ @@ -147,9 +147,9 @@ XLockDisplay(DISP); \ printf(" %s: %s(%d) got the lock\n", \ __FILE__, __FUNCTION__, __LINE__); \ - } + } while (0) -#define XUNLOCK(DISP) { \ +#define XUNLOCK(DISP) do { \ int i; \ for(i = 0; i < displ; i++) printf("%d",i); \ displ--; \ @@ -157,37 +157,33 @@ __FILE__, __FUNCTION__, __LINE__); \ fflush(stdout); \ XUnlockDisplay(DISP); \ - } + } while (0) #else -#define XLOCK(DISP) { \ +#define XLOCK(DISP) do { \ printf("%s: %s(%d) XLockDisplay (%d)\n", \ __FILE__, __FUNCTION__, __LINE__, DISP); \ fflush(stdout); \ XLockDisplay(DISP); \ printf("%s: %s(%d) got the lock (%d)\n", \ __FILE__, __FUNCTION__, __LINE__, DISP); \ - } + } while (0) -#define XUNLOCK(DISP) { \ +#define XUNLOCK(DISP) do { \ printf("%s: %s(%d) XUnlockDisplay (%d)\n", \ __FILE__, __FUNCTION__, __LINE__, DISP); \ fflush(stdout); \ XUnlockDisplay(DISP); \ - } + } while (0) #endif #else -#define XLOCK(DISP) { \ - XLockDisplay(DISP); \ - } +#define XLOCK(DISP) XLockDisplay(DISP) -#define XUNLOCK(DISP) { \ - XUnlockDisplay(DISP); \ - } +#define XUNLOCK(DISP) XUnlockDisplay(DISP) #endif |