aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/regex/regexec.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Remove ancient SCCS tags.Warner Losh2023-11-271-5/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* libc: Purge unneeded cdefs.hWarner Losh2023-11-011-1/+0
| | | | | | | | | These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Keep those. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42385
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* libc: Fix regexec when sizeof(char *) > sizeof(long)Jessica Clarke2021-12-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The states macro is the type for engine.c to use, with states1 being a local macro for regexec to use to determine whether it can use the small matcher or not (by comparing nstates and 8*sizeof(states1)). However, macro bodies are expanded in the context of their use, and so when regexec uses states1 it uses the current value of states, which is left over as char * from the large version (or, really, the multi-byte one, but that reuses large's states). For all supported architectures in FreeBSD, the two have the same size, and so this confusion is harmless. However, for architectures like CHERI where that is not the case (or Windows's LLP64 as discovered by LLVM and fixed in 2010 in 2e071faed8e2) and sizeof(char *) is bigger than sizeof(long) regexec will erroneously try to use the small matcher when nstates is between sizeof(long) and sizeof(char *) (i.e. between 64 and 128 on CHERI, or 32 and 64 on LLP64) and end up overflowing the number of bits in the underlying long if it ever uses those high states. On weirder architectures where sizeof(long) is greater than sizeof(char *) this also fixes it to not fall back on the large matcher prematurely, but such architectures are likely limited to the embedded space, if they exist at all. Fix this by swapping round states and states1, so that states1 is defined directly as being long and states is an alias for it for the small matcher case. Found by: CHERI
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* regex: unsign and constify some variables.Pedro F. Giffuni2017-04-231-3/+3
| | | | | | | | | | | Taking some hints from the regex variant in nvi(1) and higher-level compiler warnings, update some types in our regex(3) implementation. Joint work with: Kyle Evans MFC after: 2 weeks Notes: svn path=/head/; revision=317346
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Diff reduction against other *BSDs: ANSIfy functionXin LI2007-06-111-18/+11
| | | | | | | prototypes. No function changes. Notes: svn path=/head/; revision=170528
* Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-091-4/+0
| | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* Make regular expression matching aware of multibyte characters. The generalTim J. Robbins2004-07-121-3/+64
| | | | | | | | | | | | | | | | | | | | idea is that we perform multibyte->wide character conversion while parsing and compiling, then convert byte sequences to wide characters when they're needed for comparison and stepping through the string during execution. As with tr(1), the main complication is to efficiently represent sets of characters in bracket expressions. The old bitmap representation is replaced by a bitmap for the first 256 characters combined with a vector of individual wide characters, a vector of character ranges (for [A-Z] etc.), and a vector of character classes (for [[:alpha:]] etc.). One other point of interest is that although the Boyer-Moore algorithm had to be disabled in the general multibyte case, it is still enabled for UTF-8 because of its self-synchronizing nature. This greatly speeds up matching by reducing the number of multibyte conversions that need to be done. Notes: svn path=/head/; revision=132019
* Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).Jacques Vidrine2003-02-161-1/+1
| | | | | | | | | | Only warnings that could be fixed without changing the generated object code and without restructuring the source code have been handled. Reviewed by: /sbin/md5 Notes: svn path=/head/; revision=111010
* Add restrict type-qualifier.Mike Barcroft2002-10-021-3/+3
| | | | Notes: svn path=/head/; revision=104358
* Remove 'register' keyword.David E. O'Brien2002-03-211-1/+3
| | | | Notes: svn path=/head/; revision=92889
* int -> long changes that reduce the diffs with the NetBSD version toJohn Birrell1998-05-141-12/+12
| | | | | | | work in a 64-bit environment. Notes: svn path=/head/; revision=36043
* BSD 4.4 Lite Lib SourcesRodney W. Grimes1994-05-271-0/+181
Notes: svn path=/cvs2svn/branches/unlabeled-1.1.1/; revision=1573