diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:08:07 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:08:07 -0700 |
| commit | bdde4e09d21edff02ea5093b7f6eccbf166b272f (patch) | |
| tree | a64632a98a6bea6e5df864d6e5b6f2e51ea69c1c /zutil.c | |
| parent | 1c71d8b13b54f91ddec361d3053ecce26e6ff761 (diff) | |
| download | zlib-bdde4e09d21edff02ea5093b7f6eccbf166b272f.tar.gz zlib-bdde4e09d21edff02ea5093b7f6eccbf166b272f.tar.bz2 zlib-bdde4e09d21edff02ea5093b7f6eccbf166b272f.zip | |
zlib 0.92v0.92
Diffstat (limited to '')
| -rw-r--r-- | zutil.c | 32 |
1 files changed, 16 insertions, 16 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | /* $Id: zutil.c,v 1.7 1995/05/02 15:54:47 jloup Exp $ */ | 6 | /* $Id: zutil.c,v 1.8 1995/05/03 17:27:12 jloup Exp $ */ |
| 7 | 7 | ||
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | 9 | ||
| @@ -42,7 +42,7 @@ void zmemcpy(dest, source, len) | |||
| 42 | { | 42 | { |
| 43 | if (len == 0) return; | 43 | if (len == 0) return; |
| 44 | do { | 44 | do { |
| 45 | *dest++ = *source++; /* ??? to be unrolled */ | 45 | *dest++ = *source++; /* ??? to be unrolled */ |
| 46 | } while (--len != 0); | 46 | } while (--len != 0); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -52,7 +52,7 @@ void zmemzero(dest, len) | |||
| 52 | { | 52 | { |
| 53 | if (len == 0) return; | 53 | if (len == 0) return; |
| 54 | do { | 54 | do { |
| 55 | *dest++ = 0; /* ??? to be unrolled */ | 55 | *dest++ = 0; /* ??? to be unrolled */ |
| 56 | } while (--len != 0); | 56 | } while (--len != 0); |
| 57 | } | 57 | } |
| 58 | #endif | 58 | #endif |
| @@ -91,10 +91,10 @@ voidp zcalloc (voidp opaque, unsigned items, unsigned size) | |||
| 91 | ulg bsize = (ulg)items*size; | 91 | ulg bsize = (ulg)items*size; |
| 92 | 92 | ||
| 93 | if (bsize < 65536L) { | 93 | if (bsize < 65536L) { |
| 94 | buf = farmalloc(bsize); | 94 | buf = farmalloc(bsize); |
| 95 | if (*(ush*)&buf != 0) return buf; | 95 | if (*(ush*)&buf != 0) return buf; |
| 96 | } else { | 96 | } else { |
| 97 | buf = farmalloc(bsize + 16L); | 97 | buf = farmalloc(bsize + 16L); |
| 98 | } | 98 | } |
| 99 | if (buf == NULL || next_ptr >= MAX_PTR) return NULL; | 99 | if (buf == NULL || next_ptr >= MAX_PTR) return NULL; |
| 100 | table[next_ptr].org_ptr = buf; | 100 | table[next_ptr].org_ptr = buf; |
| @@ -110,19 +110,19 @@ void zcfree (voidp opaque, voidp ptr) | |||
| 110 | { | 110 | { |
| 111 | int n; | 111 | int n; |
| 112 | if (*(ush*)&ptr != 0) { /* object < 64K */ | 112 | if (*(ush*)&ptr != 0) { /* object < 64K */ |
| 113 | farfree(ptr); | 113 | farfree(ptr); |
| 114 | return; | 114 | return; |
| 115 | } | 115 | } |
| 116 | /* Find the original pointer */ | 116 | /* Find the original pointer */ |
| 117 | for (n = 0; n < next_ptr; n++) { | 117 | for (n = 0; n < next_ptr; n++) { |
| 118 | if (ptr != table[n].new_ptr) continue; | 118 | if (ptr != table[n].new_ptr) continue; |
| 119 | 119 | ||
| 120 | farfree(table[n].org_ptr); | 120 | farfree(table[n].org_ptr); |
| 121 | while (++n < next_ptr) { | 121 | while (++n < next_ptr) { |
| 122 | table[n-1] = table[n]; | 122 | table[n-1] = table[n]; |
| 123 | } | 123 | } |
| 124 | next_ptr--; | 124 | next_ptr--; |
| 125 | return; | 125 | return; |
| 126 | } | 126 | } |
| 127 | ptr = opaque; /* just to make some compilers happy */ | 127 | ptr = opaque; /* just to make some compilers happy */ |
| 128 | z_error("zcfree: ptr not found"); | 128 | z_error("zcfree: ptr not found"); |
