summaryrefslogtreecommitdiff
path: root/zutil.c
diff options
context:
space:
mode:
authorMark Adler <git@madler.net>2026-02-16 18:26:35 -0800
committerMark Adler <git@madler.net>2026-02-16 18:53:00 -0800
commit33e71060aa657e80e87b8d73e9e5cc3dd9be4e8b (patch)
tree88bdec7a6684c15406581b3fcee445e6f2cdb590 /zutil.c
parentd7bc8cafee5bdfde98732622d3b99e2f52f7b2eb (diff)
downloadzlib-33e71060aa657e80e87b8d73e9e5cc3dd9be4e8b.tar.gz
zlib-33e71060aa657e80e87b8d73e9e5cc3dd9be4e8b.tar.bz2
zlib-33e71060aa657e80e87b8d73e9e5cc3dd9be4e8b.zip
Align the backup zmem* functions with their library counterparts.
Diffstat (limited to 'zutil.c')
-rw-r--r--zutil.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/zutil.c b/zutil.c
index 6e8a3697..860faddc 100644
--- a/zutil.c
+++ b/zutil.c
@@ -150,28 +150,34 @@ const char * ZEXPORT zError(int err) {
150 150
151#ifndef HAVE_MEMCPY 151#ifndef HAVE_MEMCPY
152 152
153void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) { 153void ZLIB_INTERNAL zmemcpy(void FAR *dst, const void FAR *src, z_size_t n) {
154 if (len == 0) return; 154 uchf *p = dst;
155 do { 155 const uchf *q = src;
156 *dest++ = *source++; /* ??? to be unrolled */ 156 while (n) {
157 } while (--len != 0); 157 *p++ = *q++;
158 n--;
159 }
158} 160}
159 161
160int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) { 162int ZLIB_INTERNAL zmemcmp(const void FAR *s1, const void FAR *s2, z_size_t n) {
161 uInt j; 163 const uchf *p = s1, *q = s2;
162 164 while (n) {
163 for (j = 0; j < len; j++) { 165 if (*p++ != *q++)
164 if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; 166 return (int)p[-1] - (int)q[-1];
167 n--;
165 } 168 }
166 return 0; 169 return 0;
167} 170}
168 171
169void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) { 172void ZLIB_INTERNAL zmemzero(void FAR *b, z_size_t len) {
173 uchf *p = b;
170 if (len == 0) return; 174 if (len == 0) return;
171 do { 175 while (len) {
172 *dest++ = 0; /* ??? to be unrolled */ 176 *p++ = 0;
173 } while (--len != 0); 177 len--;
178 }
174} 179}
180
175#endif 181#endif
176 182
177#ifndef Z_SOLO 183#ifndef Z_SOLO