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 PS: 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 > posting. 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: https://github.com/danielkitta/libsigrok/commit/742b72ff2dfa12c3a627721f1566328c8eb157d9
Make that https://github.com/danielkitta/libsigrok/commit/a0c06a799f8f7deea17fe83afe960c446b00127f
Now it is https://github.com/danielkitta/libsigrok/commit/7cd786ece6ee4b5afae5db8bbce9eebd80dca116 :)
Fixed in a6dc3dacab23bf7c8da008f21a03e2a1242e77ea, thanks!