aboutsummaryrefslogtreecommitdiff
path: root/libX11/src/QuColors.c
diff options
context:
space:
mode:
Diffstat (limited to 'libX11/src/QuColors.c')
-rw-r--r--libX11/src/QuColors.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libX11/src/QuColors.c b/libX11/src/QuColors.c
index 237b8bf03..13a63eb25 100644
--- a/libX11/src/QuColors.c
+++ b/libX11/src/QuColors.c
@@ -37,9 +37,7 @@ _XQueryColors(
int ncolors)
{
register int i;
- xrgb *color;
xQueryColorsReply rep;
- long nbytes;
register xQueryColorsReq *req;
GetReq(QueryColors, req);
@@ -52,8 +50,9 @@ _XQueryColors(
/* XXX this isn't very efficient */
if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) {
- if ((color = (xrgb *)
- Xmalloc((unsigned) (nbytes = (long) ncolors * SIZEOF(xrgb))))) {
+ unsigned long nbytes = (long) ncolors * SIZEOF(xrgb);
+ xrgb *color = Xmalloc(nbytes);
+ if (color != NULL) {
_XRead(dpy, (char *) color, nbytes);
@@ -67,7 +66,8 @@ _XQueryColors(
}
Xfree((char *)color);
}
- else _XEatData(dpy, (unsigned long) nbytes);
+ else
+ _XEatDataWords(dpy, rep.length);
}
}