aboutsummaryrefslogtreecommitdiff
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
zlib-3c46f5ddb5d4c6203805209076249dd80589682b.tar.bz2
zlib-3c46f5ddb5d4c6203805209076249dd80589682b.zip
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 @@
29# include <stdlib.h> 29# include <stdlib.h>
30#endif 30#endif
31 31
32#ifdef Z_SOLO
33 typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
34#endif
35
36#ifndef local 32#ifndef local
37# define local static 33# define local static
38#endif 34#endif
@@ -170,10 +166,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
170#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX 166#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
171# if defined(_WIN32_WCE) 167# if defined(_WIN32_WCE)
172# define fdopen(fd,mode) NULL /* No fdopen() */ 168# define fdopen(fd,mode) NULL /* No fdopen() */
173# ifndef _PTRDIFF_T_DEFINED
174 typedef int ptrdiff_t;
175# define _PTRDIFF_T_DEFINED
176# endif
177# else 169# else
178# define fdopen(fd,type) _fdopen(fd,type) 170# define fdopen(fd,type) _fdopen(fd,type)
179# endif 171# endif