aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/regex
AgeCommit message (Collapse)AuthorFilesLines
2023-03-20Cygwin: regex: fix faulty check for valid range expressionCorinna Vinschen1-3/+1
Except for the "C" or "POSIX" locale, checking for start <= finish is always wrong. Range start must be <= range finish in terms of the locale's collating order. So make sure to call always wcscoll(), even in the "C"/"POSIX" locale, which makes wcscoll equivalent to wcscmp anyway. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-20Cygwin: regex: fix freeing g->charjump in low memory conditionCorinna Vinschen1-1/+1
computejumps() moves g->charjump to a position relativ to the value of CHAR_MIN. As such, g->charjump doesn't necessarily point to the address actually allocated. While regfree() takes that into account, the low memory handling in regcomp_internal() doesn't. Fix that by free'ing the actually allocated address, as in regfree(). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16Cygwin: regex: NONCHAR: re-add cast to intCorinna Vinschen1-1/+1
wint_t is unsigned int and the test checks for a negative value. Thus, it's optimized out by gcc. Add the cast from commit 44caccfca2433 to avoid this. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16Cygwin: regex: wgetnext: Re-add kludge to be more glibc compatibleCorinna Vinschen1-0/+12
Add comment to explain. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16Cygwin: regex: convert wchar_t to wint_t throughoutCorinna Vinschen3-15/+21
...and use __wcollate_range_cmp. This will have to be tweaked further when supporting collation symbols... Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16Cygwin: regex: fix build errorsCorinna Vinschen1-5/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-03-16Cygwin: replace regex with latest verbatim FreeBSD versionCorinna Vinschen11-644/+1089
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-24Cygwin: convert Windows locale handling from LCID to ISO5646 stringsCorinna Vinschen1-1/+1
Since Windows Vista, locale handling is converted from using numeric locale identifiers (LCID) to using ISO5646 locale strings. In the meantime Windows introduced new locales which don't even have a LCID attached. Those were unusable in Cygwin because locale information for these locales required to call the new locale functions taking a locale string. Convert Cygwin to drop LCIDs and use Windows ISO5646 locales instead. The last place using LCIDs is the __set_charset_from_locale function. Checking numerically is easier and uslay faster than checking strings. However, this function is clearly a TODO
2023-02-19Cygwin: convert __collate_range_cmp to __wcollate_range_cmpCorinna Vinschen1-3/+3
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=179721 After FreeBSD eventually picked up the bugreport from within only 5 years, rename __collate_range_cmp to __wcollate_range_cmp as suggested all along, and make it type safe (wint_t instead of wchar_t for hopefully obvious reasons...) While at it, drop __collate_load_error and fix the checks for it in glob and fnmatch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14Cygwin: regex: convert wchar_t to wint_tCorinna Vinschen2-39/+8
- call mbrtowi instead of mbrtowc - drop Cygwin-only surrogate handling from wgetnext and xmbrtowc since it's encapsulated in mbrtowi. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-08-05Cygwin: Add 'fallthrough' pseudo keyword for switch/case useCorinna Vinschen1-3/+3
This patch has been inspired by the Linux kernel patch 294f69e662d1 compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use written by Joe Perches <joe AT perches DOT com> based on an idea from Dan Carpenter <dan DOT carpenter AT oracle DOT com>. The following text is from the original log message: Reserve the pseudo keyword 'fallthrough' for the ability to convert the various case block /* fallthrough */ style comments to appear to be an actual reserved word with the same gcc case block missing fallthrough warning capability. All switch/case blocks now should end in one of: break; fallthrough; goto <label>; return [expression]; continue; In C mode, GCC supports the __fallthrough__ attribute since 7.1, the same time the warning and the comment parsing were introduced. Cygwin-only: add an explicit -Wimplicit-fallthrough=5 to the build flags.
2020-03-11Cygwin: fix formatting: drop spaces leading tabsCorinna Vinschen3-8/+8
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-11-24regex: Fix typo in CHaddrangeCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-20Introduce __current_locale_charset/__locale_charsetCorinna Vinschen1-2/+2
The former __locale_charset always fetched the current locale's charset. We need the per-locale charset, too, in future. Rename __locale_charset to __current_locale_charset and change __locale_charset to take a locale_t as parameter. Accommodate througout. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15POSIX-1.2008 per-thread locales, groundwork part 2Corinna Vinschen1-6/+2
Move all locale category structure definitions into setlocale.h and remove other headers in locale subdir. Create inline accessor functions for current category struct pointers and use throughout. Use pointers to "C" locale category structs by default in __global_locale. Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15POSIX-1.2008 per-thread locales, groundwork part 1Corinna Vinschen1-4/+3
Introduce first cut of struct _thr_locale_t used for the locale_t definition. Introduce global instance called __global_locale used by default. Introduce internal inline functions __get_global_locale, __get_locale_r, __get_current_locale. Remove usage of global variables in favor of accessor functions pointing to __global_locale for now. Include all local headers in locale subdir from setlocale.h to get single include for internal locale access. Introduce __CTYPE_PTR macro to replace direct access to __ctype_ptr__ and use throughout in isxxx functions. Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2015-10-20Fix compiler errors/warnings when compiling with -O3Corinna Vinschen1-1/+1
* fhandler_socket.cc (fhandler_socket::wait_for_events): Fix compiler warning in -O3 case. (fhandler_socket::connect): Ditto. * regex/regcomp.c (singleton): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2014-06-23 * regex/regcomp.c (computematchjumps): Free local memory in case ofCorinna Vinschen1-0/+3
error (CID 59975).
2013-07-21 * regex/regcomp.c (wgetnext): Add a kludge to be more glibc compatible.Corinna Vinschen1-0/+12
Add comment to explain.
2013-04-23 * Merge in cygwin-64bit-branch.Corinna Vinschen2-6/+4
2013-04-22 Adapt to changes in newlib's sys/cdefs.h:Corinna Vinschen1-4/+0
* include/sys/sysinfo.h (struct sysinfo): Rename __unused member to __f. * libc/fts.c (__FBSDID): Drop definition. * regex/regexec.c (__unused): Drop definition.
2012-06-11 * regex/regcomp.c (p_ere): Allow vertical-line followingYaakov Selkowitz1-0/+3
left-parenthesis in ERE, as in glibc.
2012-02-13 * Makefile.in (clean): Remove non-existant regexp dir.Corinna Vinschen1-13/+0
* collate.h: New header. (__collate_range_cmp): Declare. (__collate_load_error): Define. * glob.cc: Pull in latest version from FreeBSD. Simplify and reduce Cygwin-specific changes. * regex/regcomp.c: Include collate.h on Cygwin as well. (__collate_range_cmp): Move from here... * nlsfuncs.cc (__collate_range_cmp): ...to here. * miscfuncs.cc (thread_wrapper): Fix typo in comment. (CygwinCreateThread): Take dead zone of Windows stack into account. Change the way how the stack is commited and how to handle guardpages. Explain how and why. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Change definition. Explain why.
2010-02-14* regex/regcomp.c (xwcrtomb): Fix one explicable and one inexcplicable CChristopher Faylor1-2/+2
warning.
2010-02-13 * regex/regcomp.c (xwcrtomb): Don't convert Unicode chars outside theCorinna Vinschen1-8/+11
base plane always to UTF-8. Call wcsnrtombs instead to allow arbitrary multibyte charsets.
2010-02-12 * regex/regcomp.c (wgetnext): Use size_t as type for n2 since that'sCorinna Vinschen2-2/+3
what's returned by mbrtowc. * regex/regexec.c (xmbrtowc): Ditto.
2010-02-12 * regex/regcomp.c (xwcrtomb): New function to convert wide charsCorinna Vinschen2-5/+54
outside of the base plane to UTF-8. Call throughout instead of wcrtomb. (wgetnext): Handle surrogate pairs on UTF-16 systems. * regex/regexec.c (xmbrtowc): Ditto.
2010-02-11 * regex/engine.c (step): Drop Cygwin-specific definition.Corinna Vinschen3-22/+25
(NONCHAR): Better cast here to make the test work. Move comment from step here. (matcher): Disable skipping initial string in multibyte case. * regex/regcomp.c (p_bracket): Don't simplify singleton in the invert case. (p_b_term): Handle early end of pattern after dash in bracket expression. (singleton): Don't ignore the wides just because there's already a singleton in the single byte chars. Fix condition for a singleton wide accordingly. (findmust): Check for LC_CTYPE charset, rather than LC_COLLATE charset. * regex2.h (CHIN): Fix condition in the icase & invert case. (ISWORD): Fix wrong cast to unsigned char.
2010-02-04* regcomp.c (p_ere): Workaround incorrect compiler warning.Christopher Faylor2-3/+3
* regerror.c (regatoi): Return non-const string or compiler complains in certain inexplicable situations.
2010-02-04 * regex/engine.c (step): Declare and define with `int ch' rather thanCorinna Vinschen1-6/+11
`wint_t ch' parameter. Explain why. (NONCHAR): Remove related Cygwin patch here, including wrong comment.
2010-02-04 Replace regex files with multibyte-aware version from FreeBSD.Corinna Vinschen18-2103/+2658
* Makefile.in (install-headers): Remove extra command to install regex.h. (uninstall-headers): Remove extra command to uninstall regex.h. * nlsfuncs.cc (collate_lcid): Make externally available to allow access to collation internals from regex functions. (collate_charset): Ditto. * wchar.h: Add __cplusplus guards to make C-clean. * include/regex.h: New file, replacing regex/regex.h. Remove UCB advertising clause. * regex/COPYRIGHT: Accommodate BSD license. Remove UCB advertising clause. * regex/cclass.h: Remove. * regex/cname.h: New file from FreeBSD. * regex/engine.c: Ditto. (NONCHAR): Tweak for Cygwin. * regex/engine.ih: Remove. * regex/mkh: Remove. * regex/regcomp.c: New file from FreeBSD. Tweak slightly for Cygwin. Import required collate internals from nlsfunc.cc. (p_ere_exp): Add GNU-specific \< and \> handling for word boundaries. (p_simp_re): Ditto. (__collate_range_cmp): Define. (p_b_term): Use Cygwin-specific collate internals. (findmust): Ditto. * regex/regcomp.ih: Remove. * regex/regerror.c: New file from FreeBSD. Fix a few compiler warnings. * regex/regerror.ih: Remove. * regex/regex.7: New file from FreeBSD. Remove UCB advertising clause. * regex/regex.h: Remove. Replaced by include/regex.h. * regex/regexec.c: New file from FreeBSD. Fix a few compiler warnings. * regex/regfree.c: New file from FreeBSD. * regex/tests: Remove. * regex/utils.h: New file from FreeBSD.
2009-05-06 * libc/minires.c (scanline): Fix type in calls to ctype functionsCorinna Vinschen2-8/+8
to stay in unsigned char range for char values >= 0x80. * regex/regcomp.c: Ditto, throughout. * regex/regex2.h (ISWORD): Ditto.
2009-05-04* libc/minires.c (scanline): Accommodate ctype changes which disallow use of anChristopher Faylor2-8/+8
unadorned char argument to is* macros. * regex/regcomp.c: Ditto, throughout. * regex/regex2.h (ISWORD): Ditto.
2008-07-29 * Makefile.in (DLL_OFILES): Remove v8 regexp files.Corinna Vinschen1-7/+0
(OBSOLETE_FUNCTIONS): Remove v8 regexp functions. (NEW_FUNCTIONS): Remove POSIX regex functions. * cygwin.din: Export POSIX regex functions with their correct symbol name. Export with posix_ prefix for backward compatibility. * syscalls.cc (regfree): Remove ancient fake function. * regex/regex.h: Remove renaming regex functions within Cygwin. * regexp/*: Remove. * include /cygwin/version,.h: Bump API minor number.
2005-12-23* cygtls.cc (_cygtls::handle_threadlist_exception): Make an error fatal.Christopher Faylor2-2/+2
* cygtls.h (sockaddr_in): Use header rather than defining our own structure. * exceptions.cc (_cygtls::interrupt_setup): Use exact contents of sa_mask rather than assuming tht current sig should be masked, too. (_cygtls::call_signal_handler): Use more aggressive locking. * gendef (_sigbe): Wait until later before releasing incyg. (_sigreturn): Remove more arguments to accommodate quasi-sa_sigaction support. (_sigdelayed): Push arguments for sa_sigaction. More work needed here. * signal.cc (sigaction): Implement SA_NODEFER. * tlsoffsets.h: Regenerate. * sigproc.cc (wait_sig): Use default buffer size of Windows 9x complains. * pinfo.cc (_onreturn::dummy_handle): Remove. (_onreturn::h): Make this a pointer. (_onreturn::~_onreturn): Detect whether pointer is NULL rather than value is NULL. (_onreturn::_onreturn): Set h to NULL initially. (_onreturn::no_close_p_handle): Set h to NULL. (winpids::add): Initialize onreturn with value from p.hProcess immediately.
2005-05-02white space and minor comment cleanup.Christopher Faylor1-1/+1
2003-04-10 * regex/regex.h: Define regoff_t as _off_t.Corinna Vinschen2-2/+2
* regex/regex2.h: Ditto.
2002-09-30* environ.cc (environ_init): Avoid a compiler warning.Christopher Faylor3-6/+6
* path.cc (path_conv::check): Ditto. * path.h (path_conv::operator int): Ditto. * regex/engine.c: Ditto throughout. * regex/regcomp.c: Ditto throughout. * regex/regexec.c: Ditto throughout.
2002-02-15* hires.h (hires::usecs): Rename from utime. Accept an argument.Christopher Faylor1-1/+1
* strace.cc (strace::microseconds): Use hires class for calculating times. * sync.h (new_muto): Use NO_COPY explicitly in declaration. * times.cc (gettimeofday): Reflect change in usecs argument. (hires::usecs): Ditto. Changed name from utime. * winsup.h (NO_COPY): Add nocommon attribute to force setting aside space for variable. * regcomp.c (REQUIRE): Add a void cast to bypass a warning.
2001-12-20* Makefile.in (VPATH): Add regex directory.Christopher Faylor18-0/+4655
(NM): new variable. (OBSOLETE_FUNCTIONS): Ditto. (NEW_FUNCTIONS): Ditto. (install-headers): Install regex.h. (install-man): New target. (install): Use new target. (DLL_OFILES): Add v8_reg* stuff. (new-cygwin1.dll): Eliminate stamp-cygwin-lib creation. (libcygwin.a): Remove obsolete functions from import lib. Add new functions. * configure.in: Detect 'nm' tool. * configure: Regenerate. * cygwin.din: Export posix_reg* functions. Eliminate export of v8 reg* functions. This is now handled in object files themselves. * regex/*: New files. * regexp/v8_*.c: New files, renamed from non v8_ equivalents.