X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/39eb0cb563f5287270f3946804456dc766386638..2bfa3d3e1fb347ba76bddf77f3e288049635821d:/src/decompress.c diff --git a/src/decompress.c b/src/decompress.c index dc9f4b72d9..9dfec8818b 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -1,5 +1,5 @@ /* Interface to zlib. - Copyright (C) 2013 Free Software Foundation, Inc. + Copyright (C) 2013-2014 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -139,7 +139,7 @@ This function can be called only in unibyte buffers. */) z_stream stream; int inflate_status; struct decompress_unwind_data unwind_data; - ptrdiff_t count = SPECPDL_INDEX (); + dynwind_begin (); validate_region (&start, &end); @@ -149,8 +149,10 @@ This function can be called only in unibyte buffers. */) #ifdef WINDOWSNT if (!zlib_initialized) zlib_initialized = init_zlib_functions (); - if (!zlib_initialized) + if (!zlib_initialized) { + dynwind_end (); return Qnil; + } #endif /* This is a unibyte buffer, so character positions and bytes are @@ -167,8 +169,10 @@ This function can be called only in unibyte buffers. */) /* The magic number 32 apparently means "autodetect both the gzip and zlib formats" according to zlib.h. */ - if (fn_inflateInit2 (&stream, MAX_WBITS + 32) != Z_OK) + if (fn_inflateInit2 (&stream, MAX_WBITS + 32) != Z_OK) { + dynwind_end (); return Qnil; + } unwind_data.start = iend; unwind_data.stream = &stream; @@ -206,15 +210,19 @@ This function can be called only in unibyte buffers. */) } while (inflate_status == Z_OK); - if (inflate_status != Z_STREAM_END) - return unbind_to (count, Qnil); + if (inflate_status != Z_STREAM_END){ + + dynwind_end (); + return Qnil; + } unwind_data.start = 0; /* Delete the compressed data. */ del_range (istart, iend); - return unbind_to (count, Qt); + dynwind_end (); + return Qt; } @@ -224,9 +232,9 @@ This function can be called only in unibyte buffers. */) void syms_of_decompress (void) { +#include "decompress.x" + DEFSYM (Qzlib_dll, "zlib"); - defsubr (&Szlib_decompress_region); - defsubr (&Szlib_available_p); } #endif /* HAVE_ZLIB */