include: Add a generic available ARRAY_SIZE().

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-04 01:10:37 +02:00 committed by Alexandre Julliard
parent 3edbb2a4fd
commit 962b31c80b
36 changed files with 7 additions and 79 deletions

View File

@ -25,8 +25,6 @@
#include "winnls.h" #include "winnls.h"
#include "wine/heap.h" #include "wine/heap.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
const char * debugstr_sid(PSID sid) DECLSPEC_HIDDEN; const char * debugstr_sid(PSID sid) DECLSPEC_HIDDEN;
BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) DECLSPEC_HIDDEN; BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) DECLSPEC_HIDDEN;
BOOL ADVAPI_GetComputerSid(PSID sid) DECLSPEC_HIDDEN; BOOL ADVAPI_GetComputerSid(PSID sid) DECLSPEC_HIDDEN;

View File

@ -19,8 +19,6 @@
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
typedef enum { typedef enum {
ADDON_GECKO, ADDON_GECKO,
ADDON_MONO ADDON_MONO

View File

@ -22,8 +22,6 @@
#include <windef.h> #include <windef.h>
#include <winuser.h> #include <winuser.h>
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#ifndef MAX_AVISTREAMS #ifndef MAX_AVISTREAMS
#define MAX_AVISTREAMS 8 #define MAX_AVISTREAMS 8
#endif #endif

View File

@ -38,8 +38,6 @@
extern HMODULE COMCTL32_hModule DECLSPEC_HIDDEN; extern HMODULE COMCTL32_hModule DECLSPEC_HIDDEN;
extern HBRUSH COMCTL32_hPattern55AABrush DECLSPEC_HIDDEN; extern HBRUSH COMCTL32_hPattern55AABrush DECLSPEC_HIDDEN;
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/* Property sheet / Wizard */ /* Property sheet / Wizard */
#define IDD_PROPSHEET 1006 #define IDD_PROPSHEET 1006
#define IDD_WIZARD 1020 #define IDD_WIZARD 1020

View File

@ -23,8 +23,6 @@
#include "dlgs.h" #include "dlgs.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/* Common dialogs implementation globals */ /* Common dialogs implementation globals */
#define COMDLG32_Atom MAKEINTATOM(0xa000) /* MS uses this one to identify props */ #define COMDLG32_Atom MAKEINTATOM(0xa000) /* MS uses this one to identify props */

View File

@ -21,8 +21,6 @@
#include "wine/list.h" #include "wine/list.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
/* a few asn.1 tags we need */ /* a few asn.1 tags we need */
#define ASN_BOOL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01) #define ASN_BOOL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)
#define ASN_BITSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03) #define ASN_BITSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)

View File

@ -31,10 +31,6 @@
#endif #endif
#include "dwrite_2.h" #include "dwrite_2.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#endif
enum d2d_brush_type enum d2d_brush_type
{ {
D2D_BRUSH_TYPE_SOLID, D2D_BRUSH_TYPE_SOLID,

View File

@ -38,10 +38,6 @@
#include "wine/winedxgi.h" #include "wine/winedxgi.h"
#include "wine/rbtree.h" #include "wine/rbtree.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#endif
#define MAKE_TAG(ch0, ch1, ch2, ch3) \ #define MAKE_TAG(ch0, ch1, ch2, ch3) \
((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \ ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 )) ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))

View File

@ -34,8 +34,6 @@
#include <vkd3d.h> #include <vkd3d.h>
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
WINE_DEFAULT_DEBUG_CHANNEL(d3d12); WINE_DEFAULT_DEBUG_CHANNEL(d3d12);
WINE_DECLARE_DEBUG_CHANNEL(winediag); WINE_DECLARE_DEBUG_CHANNEL(winediag);

View File

@ -47,8 +47,6 @@
#define D3D9_TEXTURE_MIPMAP_DIRTY 0x1 #define D3D9_TEXTURE_MIPMAP_DIRTY 0x1
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
extern const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops DECLSPEC_HIDDEN; extern const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops DECLSPEC_HIDDEN;
HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN; HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN;

View File

@ -33,10 +33,6 @@
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
#endif
struct d3drm_object struct d3drm_object
{ {
LONG ref; LONG ref;

View File

@ -32,8 +32,6 @@
#define ULONG64_MAX (~(ULONG64)0) #define ULONG64_MAX (~(ULONG64)0)
#define ARRAY_SIZE(array) (sizeof(array)/sizeof(*array))
struct vec4 struct vec4
{ {
float x, y, z, w; float x, y, z, w;

View File

@ -39,8 +39,6 @@
#include "wine/list.h" #include "wine/list.h"
#include "wine/wined3d.h" #include "wine/wined3d.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN; extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN;
extern DWORD force_refresh_rate DECLSPEC_HIDDEN; extern DWORD force_refresh_rate DECLSPEC_HIDDEN;

View File

@ -42,7 +42,6 @@
#include "dmusicf.h" #include "dmusicf.h"
#include "dmusics.h" #include "dmusics.h"
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
/* dmloader.dll global (for DllCanUnloadNow) */ /* dmloader.dll global (for DllCanUnloadNow) */

View File

@ -24,8 +24,6 @@
#include "wine/list.h" #include "wine/list.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
static const DWRITE_MATRIX identity = static const DWRITE_MATRIX identity =
{ {
1.0f, 0.0f, 1.0f, 0.0f,

View File

@ -40,8 +40,6 @@
#include "wine/wined3d.h" #include "wine/wined3d.h"
#include "wine/winedxgi.h" #include "wine/winedxgi.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
enum dxgi_frame_latency enum dxgi_frame_latency
{ {
DXGI_FRAME_LATENCY_MAX = 16, DXGI_FRAME_LATENCY_MAX = 16,

View File

@ -35,8 +35,6 @@
#include "gdiplus.h" #include "gdiplus.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER) #define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
#define MAX_ARC_PTS (13) #define MAX_ARC_PTS (13)
#define MAX_DASHLEN (16) /* this is a limitation of gdi */ #define MAX_DASHLEN (16) /* this is a limitation of gdi */

View File

@ -77,8 +77,6 @@ static const WCHAR updateW[] = {'U','P','D','A','T','E'};
static const WCHAR valuesW[] = {'V','A','L','U','E','S'}; static const WCHAR valuesW[] = {'V','A','L','U','E','S'};
static const WCHAR whereW[] = {'W','H','E','R','E'}; static const WCHAR whereW[] = {'W','H','E','R','E'};
#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
/* /*
** These are the keywords ** These are the keywords
** They MUST be in alphabetical order ** They MUST be in alphabetical order

View File

@ -31,8 +31,6 @@
# error You must include config.h to use this header # error You must include config.h to use this header
#endif #endif
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
typedef enum { typedef enum {
MSXML_DEFAULT = 0, MSXML_DEFAULT = 0,
MSXML2 = 20, MSXML2 = 20,

View File

@ -18,8 +18,6 @@
#ifndef _SCRRUN_PRIVATE_H_ #ifndef _SCRRUN_PRIVATE_H_
#define _SCRRUN_PRIVATE_H_ #define _SCRRUN_PRIVATE_H_
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
extern HRESULT WINAPI FileSystem_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; extern HRESULT WINAPI FileSystem_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
extern HRESULT WINAPI Dictionary_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; extern HRESULT WINAPI Dictionary_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;

View File

@ -39,8 +39,6 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/list.h" #include "wine/list.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/******************************************* /*******************************************
* global SHELL32.DLL variables * global SHELL32.DLL variables
*/ */

View File

@ -32,8 +32,6 @@
#define GET_WORD(ptr) (*(const WORD *)(ptr)) #define GET_WORD(ptr) (*(const WORD *)(ptr))
#define GET_DWORD(ptr) (*(const DWORD *)(ptr)) #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#define WM_SYSTIMER 0x0118 #define WM_SYSTIMER 0x0118
#define WM_POPUPSYSTEMMENU 0x0313 #define WM_POPUPSYSTEMMENU 0x0313

View File

@ -27,10 +27,6 @@
( (ULONG)_x2 << 8 ) | \ ( (ULONG)_x2 << 8 ) | \
(ULONG)_x1 ) (ULONG)_x1 )
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#endif
enum usp10_script enum usp10_script
{ {
Script_Undefined = 0x00, Script_Undefined = 0x00,

View File

@ -58,10 +58,6 @@
#include "wine/rbtree.h" #include "wine/rbtree.h"
#include "wine/wgl_driver.h" #include "wine/wgl_driver.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#endif
#define MAKEDWORD_VERSION(maj, min) (((maj & 0xffffu) << 16) | (min & 0xffffu)) #define MAKEDWORD_VERSION(maj, min) (((maj & 0xffffu) << 16) | (min & 0xffffu))
/* Driver quirks */ /* Driver quirks */

View File

@ -36,10 +36,6 @@
/* Magic value defined by Vulkan ICD / Loader spec */ /* Magic value defined by Vulkan ICD / Loader spec */
#define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE #define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#endif
#define WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR 0x00000001 #define WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR 0x00000001
struct vulkan_func struct vulkan_func

View File

@ -25,8 +25,6 @@
#include "ole2.h" #include "ole2.h"
#include "olectl.h" #include "olectl.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/* typelibs */ /* typelibs */
typedef enum tid_t { typedef enum tid_t {
NULL_tid, NULL_tid,

View File

@ -23,8 +23,6 @@
#include "wine/heap.h" #include "wine/heap.h"
#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
static inline void *m_alloc(IMalloc *imalloc, size_t len) static inline void *m_alloc(IMalloc *imalloc, size_t len)
{ {
if (imalloc) if (imalloc)

View File

@ -137,7 +137,9 @@ extern void __winetest_cdecl winetest_trace( const char *msg, ... ) WINETEST_PRI
#define todo_wine_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "wine")) #define todo_wine_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "wine"))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #ifndef ARRAY_SIZE
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
#ifdef NONAMELESSUNION #ifdef NONAMELESSUNION
# define U(x) (x).u # define U(x) (x).u

View File

@ -759,6 +759,10 @@ typedef struct _MEMORY_BASIC_INFORMATION
#define CONTAINING_RECORD(address, type, field) \ #define CONTAINING_RECORD(address, type, field) \
((type *)((PCHAR)(address) - offsetof(type, field))) ((type *)((PCHAR)(address) - offsetof(type, field)))
#ifdef __WINESRC__
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
/* Types */ /* Types */
typedef struct _LIST_ENTRY { typedef struct _LIST_ENTRY {

View File

@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define ARRAY_SIZE(a) sizeof(a)/sizeof((a)[0])
#include "notepad_res.h" #include "notepad_res.h"
#define MAX_STRING_LEN 255 #define MAX_STRING_LEN 255

View File

@ -21,7 +21,6 @@
#include "resource.h" #include "resource.h"
#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
#define MAX_SUBKEY_LEN 257 #define MAX_SUBKEY_LEN 257
/* reg.c */ /* reg.c */

View File

@ -30,8 +30,6 @@
#define SPLIT_WIDTH 5 #define SPLIT_WIDTH 5
#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
#define MAX_NEW_KEY_LEN 128 #define MAX_NEW_KEY_LEN 128
#define KEY_MAX_LEN 1024 #define KEY_MAX_LEN 1024

View File

@ -43,8 +43,6 @@ static HKEY reg_class_keys[] = {
HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_DYN_DATA HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_DYN_DATA
}; };
#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
void *heap_xalloc(size_t size) void *heap_xalloc(size_t size)
{ {
void *buf = heap_alloc(size); void *buf = heap_alloc(size);

View File

@ -38,8 +38,6 @@
#define IS_OPTION_FALSE(ch) \ #define IS_OPTION_FALSE(ch) \
((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0') ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
extern WCHAR* current_app; /* NULL means editing global settings */ extern WCHAR* current_app; /* NULL means editing global settings */
/* Use get_reg_key and set_reg_key to alter registry settings. The changes made through /* Use get_reg_key and set_reg_key to alter registry settings. The changes made through

View File

@ -39,8 +39,6 @@
#include "oaidl.h" #include "oaidl.h"
#include <wine/list.h> #include <wine/list.h>
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define ADDRSIZE (dbg_curr_process->be_cpu->pointer_size) #define ADDRSIZE (dbg_curr_process->be_cpu->pointer_size)
#define ADDRWIDTH (ADDRSIZE * 2) #define ADDRWIDTH (ADDRSIZE * 2)

View File

@ -35,8 +35,6 @@
#include "windef.h" #include "windef.h"
#include "guiddef.h" #include "guiddef.h"
#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
#define TOKEN_NAME 1 #define TOKEN_NAME 1
#define TOKEN_STRING 2 #define TOKEN_STRING 2
#define TOKEN_INTEGER 3 #define TOKEN_INTEGER 3