casaroli opened a new pull request, #20748:
URL: https://github.com/apache/nuttx/pull/20748

   ## Summary
   
   `REG_STARTEND` lets `regexec()` search only `string[pmatch[0].rm_so, 
pmatch[0].rm_eo)`. The text does not need a NUL terminator, and it can contain 
NUL bytes. Programs such as git use it to search a buffer that is not a C 
string. NuttX did not have the flag.
   
   This PR adds `REG_STARTEND` (value 4) to `regex.h` and to `regexec()`. The 
first commit only fixes the nxstyle errors in `regexec.c`.
   
   The rules at the edges of the range:
   
   - `^` matches at `rm_so` unless `REG_NOTBOL` is set, as on BSD.
   - A NUL byte inside the range is an ordinary character, so `abc$` does not 
match `"abc\0def"`.
   - An invalid range (`rm_so < 0` or `rm_eo < rm_so`) gives `REG_NOMATCH`.
   - The offsets in `pmatch` are from the start of `string`, not from `rm_so`.
   
   ## Impact
   
   Without `REG_STARTEND`, `regexec()` does not change.
   
   ## Testing
   
   A test program with 15 checks (a range inside a string, `^` and `$` at the 
range ends, `REG_NOTBOL`, a subexpression, NUL bytes inside the range, a 
back-reference inside and past the end of the range, an empty range, and the 
`pmatch` offsets) on `qemu-armv8a:knsh` with `CONFIG_LIBC_REGEX`: 15 of 15 
pass. On master 10 of them fail.
   
   `ostest` on `qemu-armv8a:knsh` and `qemu-armv8a:nsh` ends with `ostest_main: 
Exiting with status 0`. `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to