Add wxCHECK_GLIBC_VERSION() and cleanup glibc version checks

Use this macro where possible and simplify the checks in a couple of
places where it isn't (because we're checking for an exact glibc
version).

No real changes.
This commit is contained in:
Vadim Zeitlin 2022-06-23 18:09:35 +02:00
parent bf6fe7f949
commit d74a4ea30d
6 changed files with 34 additions and 8 deletions

View file

@ -38,6 +38,7 @@
#ifdef HAVE_ICONV
#include <iconv.h>
#include "wx/thread.h"
#include "wx/private/glibc.h"
#endif
#include "wx/encconv.h"
@ -2037,7 +2038,7 @@ wxMBConvUTF32swap::FromWChar(char *dst, size_t dstLen,
// bytes-left-in-input buffer is non-zero. Hence, this alternative test for
// iconv() failure.
// [This bug does not appear in glibc 2.2.]
#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 1
#if wxCHECK_GLIBC_VERSION(2, 0) && !wxCHECK_GLIBC_VERSION(2, 2)
#define ICONV_FAILED(cres, bufLeft) ((cres == (size_t)-1) && \
(errno != E2BIG || bufLeft != 0))
#else