diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-03-09 09:26:05 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-03-09 23:12:14 -0800 |
commit | f870dfb47da9d43d1750ea5e5fc9288c4158f7ad (patch) | |
tree | 7868dc6b9c9028bc3141bff2afba40fb17e3f875 | |
parent | ad2a06d4d3c60198bc40116623153f71a208a240 (diff) |
XFixesFetchRegionAndBounds: use nread in call to XReadPad
We already went through the trouble of calculating a variable with the
amount to read, might as well use it instead of recalculating it.
Also move initialization of the variable to the point it's needed/used
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/Region.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Region.c b/src/Region.c index 94c5403..042f966 100644 --- a/src/Region.c +++ b/src/Region.c @@ -335,7 +335,6 @@ XFixesFetchRegionAndBounds (Display *dpy, bounds->height = rep.height; nbytes = (long) rep.length << 2; nrects = rep.length >> 1; - nread = nrects << 3; rects = Xmalloc (nrects * sizeof (XRectangle)); if (!rects) { @@ -344,7 +343,8 @@ XFixesFetchRegionAndBounds (Display *dpy, SyncHandle (); return NULL; } - _XRead16 (dpy, (short *) rects, nrects << 3); + nread = nrects << 3; + _XRead16 (dpy, (short *) rects, nread); /* skip any padding */ if(nbytes > nread) { |