Created attachment 169 [details]
Add zip_discard() macro when libzip < 0.11
This tiny patch makes libsigrok again compatible with libzip 0.10 by defining zip_discard() as an empty preprocessor macro.
libzip 0.10 is still in broad use, because long-term-support Linux distributions like Ubuntu 14.04 ship this version.
So I think it is quite important to be able to build libsigrok on these.
libzip >= 0.11 requirement was introduced in http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff;h=896fc9c7231c7567cda84404eb0fcdd889b556a2
due to the use of zip_discard() introduced in http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff;h=8d4097ffa69249be0fac8ab5d6a6e1e0b5fc368b
Thanks for your great work!
Better to define zip_discard as zip_close to avoid leaks. This still won't deal with cleanup after failed write at close time, but I guess we can live with that.
However, I don't really like the idea of introducing a macro like that via AC_DEFINE(). I think it's better to use AC_CHECK_FUNCS() and use the generated HAVE_ZIP_DISCARD macro for a conditional in libsigrok-internal.h.
*** Bug 677 has been marked as a duplicate of this bug. ***
*** Bug 675 has been marked as a duplicate of this bug. ***
*** Bug 676 has been marked as a duplicate of this bug. ***
(In reply to comment #4)
> *** Bug 676 has been marked as a duplicate of this bug. ***
Sorry, for the duplicates! I've run into an "Internal Server Error" while posting.
(In reply to comment #5)
> Sorry, for the duplicates! I've run into an "Internal Server Error" while
No prob, everyone seems to get this at the moment. It appears that it works anyway, though.
I just had another look at the libzip manual pages. It appears that the best way to replace zip_discard() is zip_unchange_all() followed by zip_close().
One way to go about this could be to implement a function which does that (e.g. sr_zip_discard()), and conditionally define zip_discard() to sr_zip_discard() if zip_discard() is not natively available.
This should fix the problem:
Now it is
Fixed in a6dc3dacab23bf7c8da008f21a03e2a1242e77ea, thanks!