aboutsummaryrefslogtreecommitdiff
path: root/zutil.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2015-10-04 11:45:00 -0700
committerMark Adler <madler@alumni.caltech.edu>2015-10-04 11:48:42 -0700
commit8f1b3744e52b2adb6475c3cd7a07ff9331e9c2fa (patch)
tree5dbe4bda0efa9738baa35412f738c4ebf1f6317c /zutil.c
parentf77c9823441ba169b3877976cb40b72731aa7980 (diff)
downloadzlib-8f1b3744e52b2adb6475c3cd7a07ff9331e9c2fa.tar.gz
zlib-8f1b3744e52b2adb6475c3cd7a07ff9331e9c2fa.tar.bz2
zlib-8f1b3744e52b2adb6475c3cd7a07ff9331e9c2fa.zip
Use a consistent and more modern approach to not use a parameter.
A remarkably creative and diverse set of approaches to letting the compiler know that opaque was being used when it wasn't is changed by this commit to the more standard (void)opaque.
Diffstat (limited to 'zutil.c')
-rw-r--r--zutil.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/zutil.c b/zutil.c
index 15add3b..167ed5f 100644
--- a/zutil.c
+++ b/zutil.c
@@ -219,9 +219,11 @@ local ptr_table table[MAX_PTR];
219 219
220voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) 220voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
221{ 221{
222 voidpf buf = opaque; /* just to make some compilers happy */ 222 voidpf buf;
223 ulg bsize = (ulg)items*size; 223 ulg bsize = (ulg)items*size;
224 224
225 (void)opaque;
226
225 /* If we allocate less than 65520 bytes, we assume that farmalloc 227 /* If we allocate less than 65520 bytes, we assume that farmalloc
226 * will return a usable pointer which doesn't have to be normalized. 228 * will return a usable pointer which doesn't have to be normalized.
227 */ 229 */
@@ -244,6 +246,9 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
244void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) 246void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
245{ 247{
246 int n; 248 int n;
249
250 (void)opaque;
251
247 if (*(ush*)&ptr != 0) { /* object < 64K */ 252 if (*(ush*)&ptr != 0) { /* object < 64K */
248 farfree(ptr); 253 farfree(ptr);
249 return; 254 return;
@@ -259,7 +264,6 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
259 next_ptr--; 264 next_ptr--;
260 return; 265 return;
261 } 266 }
262 ptr = opaque; /* just to make some compilers happy */
263 Assert(0, "zcfree: ptr not found"); 267 Assert(0, "zcfree: ptr not found");
264} 268}
265 269
@@ -278,13 +282,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
278 282
279voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) 283voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
280{ 284{
281 if (opaque) opaque = 0; /* to make compiler happy */ 285 (void)opaque;
282 return _halloc((long)items, size); 286 return _halloc((long)items, size);
283} 287}
284 288
285void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) 289void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
286{ 290{
287 if (opaque) opaque = 0; /* to make compiler happy */ 291 (void)opaque;
288 _hfree(ptr); 292 _hfree(ptr);
289} 293}
290 294
@@ -306,7 +310,7 @@ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
306 unsigned items; 310 unsigned items;
307 unsigned size; 311 unsigned size;
308{ 312{
309 if (opaque) items += size - size; /* make compiler happy */ 313 (void)opaque;
310 return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : 314 return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
311 (voidpf)calloc(items, size); 315 (voidpf)calloc(items, size);
312} 316}
@@ -315,8 +319,8 @@ void ZLIB_INTERNAL zcfree (opaque, ptr)
315 voidpf opaque; 319 voidpf opaque;
316 voidpf ptr; 320 voidpf ptr;
317{ 321{
322 (void)opaque;
318 free(ptr); 323 free(ptr);
319 if (opaque) return; /* make compiler happy */
320} 324}
321 325
322#endif /* MY_ZCALLOC */ 326#endif /* MY_ZCALLOC */