[PATCH] Zero buffer data in BufAlloc()

Jeremy Huddleston jeremyhu at apple.com
Wed Sep 8 12:16:52 PDT 2010


Neat.

Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Sep 8, 2010, at 07:44, 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
> -- 
> 1.7.2.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



More information about the xorg-devel mailing list