Commit 33e7106 for zlib

commit 33e71060aa657e80e87b8d73e9e5cc3dd9be4e8b
Author: Mark Adler <git@madler.net>
Date:   Mon Feb 16 18:26:35 2026 -0800

    Align the backup zmem* functions with their library counterparts.

diff --git a/deflate.c b/deflate.c
index b634cbd..96c48dd 100644
--- a/deflate.c
+++ b/deflate.c
@@ -170,8 +170,7 @@ local const config configuration_table[10] = {
 #define CLEAR_HASH(s) \
     do { \
         s->head[s->hash_size - 1] = NIL; \
-        zmemzero((Bytef *)s->head, \
-                 (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
+        zmemzero(s->head, (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
         s->slid = 0; \
     } while (0)

@@ -1331,13 +1330,13 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {

     ss = source->state;

-    zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
+    zmemcpy(dest, source, sizeof(z_stream));

     ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
     if (ds == Z_NULL) return Z_MEM_ERROR;
     zmemzero(ds, sizeof(deflate_state));
     dest->state = (struct internal_state FAR *) ds;
-    zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
+    zmemcpy(ds, ss, sizeof(deflate_state));
     ds->strm = dest;

     ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
@@ -1352,10 +1351,10 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
     }
     /* following zmemcpy's do not work for 16-bit MSDOS */
     zmemcpy(ds->window, ss->window, ss->high_water);
-    zmemcpy((voidpf)ds->prev, (voidpf)ss->prev,
+    zmemcpy(ds->prev, ss->prev,
             (ss->slid || ss->strstart - ss->insert > ds->w_size ? ds->w_size :
                 ss->strstart - ss->insert) * sizeof(Pos));
-    zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
+    zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));

     ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
     zmemcpy(ds->pending_out, ss->pending_out, ss->pending);
diff --git a/inflate.c b/inflate.c
index 6baa4df..91c01f9 100644
--- a/inflate.c
+++ b/inflate.c
@@ -1351,8 +1351,8 @@ int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) {
     }

     /* copy state */
-    zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
-    zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
+    zmemcpy(dest, source, sizeof(z_stream));
+    zmemcpy(copy, state, sizeof(struct inflate_state));
     copy->strm = dest;
     if (state->lencode >= state->codes &&
         state->lencode <= state->codes + ENOUGH - 1) {
diff --git a/zutil.c b/zutil.c
index 6e8a369..860fadd 100644
--- a/zutil.c
+++ b/zutil.c
@@ -150,28 +150,34 @@ const char * ZEXPORT zError(int err) {

 #ifndef HAVE_MEMCPY

-void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) {
-    if (len == 0) return;
-    do {
-        *dest++ = *source++; /* ??? to be unrolled */
-    } while (--len != 0);
+void ZLIB_INTERNAL zmemcpy(void FAR *dst, const void FAR *src, z_size_t n) {
+    uchf *p = dst;
+    const uchf *q = src;
+    while (n) {
+        *p++ = *q++;
+        n--;
+    }
 }

-int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) {
-    uInt j;
-
-    for (j = 0; j < len; j++) {
-        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+int ZLIB_INTERNAL zmemcmp(const void FAR *s1, const void FAR *s2, z_size_t n) {
+    const uchf *p = s1, *q = s2;
+    while (n) {
+        if (*p++ != *q++)
+            return (int)p[-1] - (int)q[-1];
+        n--;
     }
     return 0;
 }

-void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) {
+void ZLIB_INTERNAL zmemzero(void FAR *b, z_size_t len) {
+    uchf *p = b;
     if (len == 0) return;
-    do {
-        *dest++ = 0;  /* ??? to be unrolled */
-    } while (--len != 0);
+    while (len) {
+        *p++ = 0;
+        len--;
+    }
 }
+
 #endif

 #ifndef Z_SOLO
diff --git a/zutil.h b/zutil.h
index 0f983f7..80f6d85 100644
--- a/zutil.h
+++ b/zutil.h
@@ -218,9 +218,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
 #    define zmemzero(dest, len) memset(dest, 0, len)
 #  endif
 #else
-   void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
-   int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
-   void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
+   void ZLIB_INTERNAL zmemcpy(void FAR *, const void FAR *, z_size_t);
+   int ZLIB_INTERNAL zmemcmp(const void FAR *, const void FAR *, z_size_t);
+   void ZLIB_INTERNAL zmemzero(void FAR *, z_size_t);
 #endif

 /* Diagnostic functions */