1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Bug 1060: #undef HAVE_TRE_REGEX_H only in elinks.h

I didn't read the code of the tre library, but I suppose that when sizes of
wchar_t and unicode_val_T are equal it will work fine.

[ From bug 1060 attachment 508.  --KON ]
This commit is contained in:
Witold Filipczyk 2008-12-26 10:02:00 +01:00 committed by Kalle Olavi Niemitalo
parent c5a7f87c43
commit 664048098a
2 changed files with 25 additions and 0 deletions

View File

@ -917,6 +917,7 @@ fi
AC_MSG_RESULT($cf_result)
if test "$cf_result" = yes; then
AC_CHECK_HEADERS(tre/regex.h)
AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
fi
# ===================================================================

View File

@ -29,6 +29,30 @@
#define DEBUG_MEMLEAK
#endif
/* When CONFIG_UTF8 is defined, src/viewer/text/search.c makes a string
* of unicode_val_T and gives it to regwexec(), which expects a string
* of wchar_t. If the unicode_val_T and wchar_t types are too different,
* this won't work, so try to detect that and disable regexp operations
* entirely in that case.
*
* Currently, this code only compares the sizes of the types. Because
* unicode_val_T is defined as uint32_t and POSIX says bytes are 8-bit,
* sizeof(unicode_val_T) is 4 and the following compares SIZEOF_WCHAR_T
* to that.
*
* C99 says the implementation can define __STDC_ISO_10646__ if wchar_t
* values match ISO 10646 (or Unicode) numbers in all locales. Do not
* check that macro here, because it is too restrictive: it should be
* enough for ELinks if the values match in the locales where ELinks is
* actually run. */
#ifdef CONFIG_UTF8
#if SIZEOF_WCHAR_T != 4
#undef HAVE_TRE_REGEX_H
#endif
#endif
/* This maybe overrides some of the standard high-level functions, to ensure
* the expected behaviour. These overrides are not system specific. */
#include "osdep/stub.h"