[PATCH] Zero buffer data in BufAlloc()

Alan Coopersmith alan.coopersmith at oracle.com
Thu Sep 9 23:39:04 PDT 2010


Adam Jackson wrote:
> 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

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list