summaryrefslogtreecommitdiff
path: root/zutil.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2017-06-03 09:49:39 -0700
committerMark Adler <madler@alumni.caltech.edu>2017-06-03 09:53:33 -0700
commit3c46f5ddb5d4c6203805209076249dd80589682b (patch)
treeedfdce5921b4009afc0f0d352f324a00da859d69 /zutil.h
parent44e8ac810d7d50381429a15cdc6e48816beafd2b (diff)
downloadzlib-3c46f5ddb5d4c6203805209076249dd80589682b.tar.gz
Avoid the use of ptrdiff_t.
This isn't the right type anyway to assure that it contains a pointer. That type would be intptr_t or uintptr_t. However the C99 standard says that those types are optional, so their use would not be portable. This commit simply uses size_t or whatever configure decided to use for size_t. That would be the same length as ptrdiff_t, and so will work just as well. The code checks to see if the length of the type used is the same as the length of a void pointer, so there is already protection against the use of the wrong type. The use of size_t (or ptrdiff_t) will almost always work, as all modern architectures have an array size that is the same as the pointer size. Only old segmented architectures would have to fall back to the slower CRC-32 calculation, where the amount of memory that can be accessed is larger than the maximum array size.
Diffstat (limited to 'zutil.h')
-rw-r--r--zutil.h8
1 files changed, 0 insertions, 8 deletions
diff --git a/zutil.h b/zutil.h
index b079ea6..60a0bca 100644
--- a/zutil.h
+++ b/zutil.h
@@ -29,10 +29,6 @@
# include <stdlib.h>
#endif
-#ifdef Z_SOLO
- typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
-#endif
-
#ifndef local
# define local static
#endif
@@ -170,10 +166,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
# if defined(_WIN32_WCE)
# define fdopen(fd,mode) NULL /* No fdopen() */
-# ifndef _PTRDIFF_T_DEFINED
- typedef int ptrdiff_t;
-# define _PTRDIFF_T_DEFINED
-# endif
# else
# define fdopen(fd,type) _fdopen(fd,type)
# endif