[PATCH] Zero buffer data in BufAlloc()

Adam Jackson ajax at redhat.com
Wed Sep 8 07:44:23 PDT 2010


Inspired by a pattern in NoMachine's NX.  Consistently zeroed buffers
compress better with ssh and friends.  Note that you'll need to rebuild
all your protocol libraries to take advantage of this.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 include/X11/Xlibint.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index e765cc9..77f0dc7 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -626,7 +626,7 @@ extern void _XFlushGCCache(Display *dpy, GC gc);
     if (dpy->bufptr + (n) > dpy->bufmax) \
         _XFlush (dpy); \
     ptr = (type) dpy->bufptr; \
-    (void)ptr; \
+    memset(ptr, '\0', n); \
     dpy->bufptr += (n);
 
 #ifdef WORD64
-- 
1.7.2.2



More information about the xorg-devel mailing list