Skip to content

Commit

Permalink
Fix unused-but-set-variable gcc warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Zimmermann committed Dec 10, 2019
1 parent 25f8541 commit 97ff56a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/zlib_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,23 @@ struct wrap_strm {
void zlib_finalize(value vwrap)
{
struct wrap_strm *wrap = Data_custom_val(vwrap);
#ifdef DEBUG
int ret;
#endif

if (wrap->flags & ZLIB_INFLATE)
ret = inflateEnd(wrap->strm);
#ifdef DEBUG
ret =
#endif
inflateEnd(wrap->strm);
else
ret = deflateEnd(wrap->strm);
#ifdef DEBUG
ret =
#endif
deflateEnd(wrap->strm);

/* CAMLassert does only access ret when DEBUG is defined.
* In case DEBUG is not defined, gcc would warn unused-but-set-variable. */
CAMLassert(ret == Z_OK || ret == Z_DATA_ERROR);
caml_stat_free(wrap->strm);
caml_stat_free(wrap->header);
Expand Down

0 comments on commit 97ff56a

Please sign in to comment.