From: Paul R. Eggert Date: Mon, 19 Jul 2010 17:22:10 +0000 (-0700) Subject: gzip: don't assume C99, and don't assume overlapping memcpy should work X-Git-Tag: v1.5~67 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=696826daf93f6870a71b88ebf355e1560b9e6c18;p=debian%2Fgzip gzip: don't assume C99, and don't assume overlapping memcpy should work * tailor.h (NOMEMCPY): Remove. memcpy is entitled to not work on overlapping blocks. * inflate.c (inflate_codes): Don't put decl after statement. Omit NOMEMCPY. --- diff --git a/inflate.c b/inflate.c index 5f2f303..012bcb9 100644 --- a/inflate.c +++ b/inflate.c @@ -588,16 +588,15 @@ int bl, bd; /* number of bits decoded by tl[] and td[] */ /* do the copy */ do { n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); -#if !defined(NOMEMCPY) && !defined(DEBUG) - unsigned int delta = w > d ? w - d : d - w; - if (delta >= e) +#ifndef DEBUG + if (e <= (d < w ? w - d : d - w)) { memcpy(slide + w, slide + d, e); w += e; d += e; } else /* do it slow to avoid memcpy() overlap */ -#endif /* !NOMEMCPY */ +#endif do { slide[w++] = slide[d++]; Tracevv((stderr, "%c", slide[w-1])); diff --git a/tailor.h b/tailor.h index 4fe0da0..cc150ef 100644 --- a/tailor.h +++ b/tailor.h @@ -227,10 +227,6 @@ # endif #endif -#if defined(pyr) && !defined(NOMEMCPY) /* Pyramid */ -# define NOMEMCPY /* problem with overlapping copies */ -#endif - #ifdef TOPS20 # define OS_CODE 0x0a #endif