diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2025-02-21 14:08:58 -0800 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2025-02-23 23:58:30 -0800 |
| commit | aa27ba467717707881e4ae925849e6229ceabf38 (patch) | |
| tree | 4f9f93c0743ed44bb3e979f7247a0f8384c41055 | |
| parent | 4d1c7207ffaea5b02a4fd822ef4bbf3d333fe4f7 (diff) | |
| download | zlib-aa27ba467717707881e4ae925849e6229ceabf38.tar.gz zlib-aa27ba467717707881e4ae925849e6229ceabf38.tar.bz2 zlib-aa27ba467717707881e4ae925849e6229ceabf38.zip | |
Avoid a fruitless memory copy in gzread.c.
| -rw-r--r-- | gzread.c | 10 |
1 files changed, 6 insertions, 4 deletions
| @@ -50,10 +50,12 @@ local int gz_avail(gz_statep state) { | |||
| 50 | if (strm->avail_in) { /* copy what's there to the start */ | 50 | if (strm->avail_in) { /* copy what's there to the start */ |
| 51 | unsigned char *p = state->in; | 51 | unsigned char *p = state->in; |
| 52 | unsigned const char *q = strm->next_in; | 52 | unsigned const char *q = strm->next_in; |
| 53 | unsigned n = strm->avail_in; | 53 | if (q != p) { |
| 54 | do { | 54 | unsigned n = strm->avail_in; |
| 55 | *p++ = *q++; | 55 | do { |
| 56 | } while (--n); | 56 | *p++ = *q++; |
| 57 | } while (--n); | ||
| 58 | } | ||
| 57 | } | 59 | } |
| 58 | if (gz_load(state, state->in + strm->avail_in, | 60 | if (gz_load(state, state->in + strm->avail_in, |
| 59 | state->size - strm->avail_in, &got) == -1) | 61 | state->size - strm->avail_in, &got) == -1) |
