Be more type-safe when calling setjmp(); call the same one that libpng would
Depending whether _BSD_SOURCE is preferred, glibc will provide one of two
implementations of setjmp()/longjmp() (it either does or doesn't save the
signal mask), acting on different definitions of the jmp_buf struct.
libpng calls longjmp() internally, and expects its callers to call the
version of setjmp() corresponding to the longjmp() call that libpng would
make.
In an attempt to ensure that consistent versions of setjmp() and longjmp()
are used, pngconf.h insists that on Linux, setjmp.h has not already been
included. However, quakedef.h includes that header, leading to some
interesting contortions when using the system libpng.
(IMO the right thing for libpng to do would be for it to provide an exported
function png_setjmp (or something) which calls the version of setjmp() that
libpng expects on the jmp_buf included in the png structure, like qpng_setjmp
in this patch.)
When using the system libpng headers, this patch also avoids the assumption
that jmp_buf is the first thing in the png structure.