diff options
author | Daniel Martin <consume.noise@gmail.com> | 2017-10-27 16:11:56 +0200 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-10-30 13:45:20 -0400 |
commit | d5379b350fb63e42e604361c21ad9832b4c791b9 (patch) | |
tree | 9ff0602258e2d4afb74561614810fb8a8e0e1860 /dix/privates.c | |
parent | 15a32ee5d1fffa171bb05af9a0e5b472e4af1488 (diff) |
Use ARRAY_SIZE all over the tree
Roundhouse kick replacing the various (sizeof(foo)/sizeof(foo[0])) with
the ARRAY_SIZE macro from dix.h when possible. A semantic patch for
coccinelle has been used first. Additionally, a few macros have been
inlined as they had only one or two users.
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'dix/privates.c')
-rw-r--r-- | dix/privates.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/dix/privates.c b/dix/privates.c index 9a4e61138..9ca80f0b6 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -571,8 +571,6 @@ static const int offsets[] = { offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */ }; -#define NUM_OFFSETS (sizeof (offsets) / sizeof (offsets[0])) - int dixLookupPrivateOffset(RESTYPE type) { @@ -587,7 +585,7 @@ dixLookupPrivateOffset(RESTYPE type) return offsets[RT_PIXMAP & TypeMask]; } type = type & TypeMask; - if (type < NUM_OFFSETS) + if (type < ARRAY_SIZE(offsets)) return offsets[type]; return -1; } |