From 3e9ce1c26fdeaf5bfef48f4630251e280e7cf718 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Sat, 7 Jul 2018 23:39:08 +0200 Subject: [PATCH] winex11.drv: Avoid ARRAY_SIZE-like macros. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/winex11.drv/clipboard.c | 10 +++++----- dlls/winex11.drv/desktop.c | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index c55a2661fb4..296c00c3a58 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -187,7 +187,6 @@ static const struct static struct list format_list = LIST_INIT( format_list ); -#define NB_BUILTIN_FORMATS (sizeof(builtin_formats) / sizeof(builtin_formats[0])) #define GET_ATOM(prop) (((prop) < FIRST_XATOM) ? (Atom)(prop) : X11DRV_Atoms[(prop) - FIRST_XATOM]) static DWORD clipboard_thread_id; @@ -295,9 +294,9 @@ static void register_builtin_formats(void) struct clipboard_format *formats; unsigned int i; - if (!(formats = HeapAlloc( GetProcessHeap(), 0, NB_BUILTIN_FORMATS * sizeof(*formats)))) return; + if (!(formats = HeapAlloc( GetProcessHeap(), 0, ARRAY_SIZE(builtin_formats) * sizeof(*formats)))) return; - for (i = 0; i < NB_BUILTIN_FORMATS; i++) + for (i = 0; i < ARRAY_SIZE(builtin_formats); i++) { if (builtin_formats[i].name) formats[i].id = RegisterClipboardFormatW( builtin_formats[i].name ); @@ -983,7 +982,7 @@ static HANDLE import_targets( Atom type, const void *data, size_t size ) register_x11_formats( properties, count ); /* the builtin formats contain duplicates, so allocate some extra space */ - if (!(formats = HeapAlloc( GetProcessHeap(), 0, (count + NB_BUILTIN_FORMATS) * sizeof(*formats )))) + if (!(formats = HeapAlloc( GetProcessHeap(), 0, (count + ARRAY_SIZE(builtin_formats)) * sizeof(*formats )))) return 0; pos = 0; @@ -1454,7 +1453,8 @@ static BOOL export_targets( Display *display, Window win, Atom prop, Atom target if (!(formats = get_clipboard_formats( &count ))) return FALSE; /* the builtin formats contain duplicates, so allocate some extra space */ - if (!(targets = HeapAlloc( GetProcessHeap(), 0, (count + NB_BUILTIN_FORMATS) * sizeof(*targets) ))) + if (!(targets = HeapAlloc( GetProcessHeap(), 0, + (count + ARRAY_SIZE(builtin_formats)) * sizeof(*targets) ))) { HeapFree( GetProcessHeap(), 0, formats ); return FALSE; diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 4df8784a97e..559efe2beb3 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -73,7 +73,6 @@ static struct screen_size { {1920, 1200}, {2560, 1600} }; -#define NUM_DESKTOP_MODES (sizeof(screen_sizes) / sizeof(struct screen_size)) #define _NET_WM_STATE_REMOVE 0 #define _NET_WM_STATE_ADD 1 @@ -88,7 +87,7 @@ static void make_modes(void) /* original specified desktop size */ X11DRV_Settings_AddOneMode(screen_width, screen_height, 0, 60); - for (i=0; i