summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-11-10 11:09:56 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-11-10 11:46:43 -0800
commit563ddd4ff5575e3f8bbf635cbdc339b09a7e285e (patch)
treeff45e7ac733192cbb35d0b20b040aeeb37cfa46c
parent5e22c4b3d56d8327d8610faabc8ecfc0c45399de (diff)
BufAlloc: add do { ... } while (0) to avoid -Wextra-semi-stmt warnings
Clears 46 warnings from clang of the form: XKB.c:207:69: warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] BufAlloc(char *, out, (((size * 2) + (unsigned) 3) / 4) * 4); ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
-rw-r--r--include/X11/Xlibint.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index b03a2ed1..9f27b229 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -668,12 +668,13 @@ extern void _XFlushGCCache(Display *dpy, GC gc);
* BufAlloc (xTextElt *, elt, nbytes)
*/
-#define BufAlloc(type, ptr, n) \
+#define BufAlloc(type, ptr, n) do { \
if (dpy->bufptr + (n) > dpy->bufmax) \
_XFlush (dpy); \
ptr = (type) dpy->bufptr; \
memset(ptr, '\0', (size_t)(n)); \
- dpy->bufptr += (n);
+ dpy->bufptr += (n); \
+} while (0)
#define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))