Re: [PATCH v9] regex.3: Destandardeseify Match offsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 4/21/23 14:55, наб wrote:
> This section reads like it were (and pretty much is) lifted from POSIX.
> That's hard to read, because POSIX is horrendously verbose, as usual.
> 
> Instead, synopsise it into something less formal but more reasonable,
> and describe the resulting range with a range instead of a paragraph.
> 
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
> ---
> This is the last one.
> 
> Range-diff against v8:
> 1:  4479e1572 < -:  --------- regex.3: Desoupify regerror() description
> 2:  bad307847 < -:  --------- regex.3, regex_t.3type, regmatch_t.3type, regoff_t.3type: Move & link regex_t.3type into regex.3
> 3:  edefa8a5e < -:  --------- regex.3: Finalise move of reg*.3type
> 4:  500070a5e ! 1:  9af6c6b7f regex.3: Destandardeseify Match offsets
>     @@ man3/regex.3: .SS Matching
>      +Each returned valid
>      +.RB (non- \-1 )
>      +match corresponds to the range
>     -+.RI [ string " + " rm_so ", " string " + " rm_eo ).
>     ++.RI [ "string + rm_so" , " string + rm_eo" ).
>       .PP
>       .I regoff_t
>       is a signed integer type
> 
>  man3/regex.3 | 53 +++++++++++++++++++++++++---------------------------
>  1 file changed, 25 insertions(+), 28 deletions(-)
> 
> diff --git a/man3/regex.3 b/man3/regex.3
> index 30f2ef318..aae31c1e9 100644
> --- a/man3/regex.3
> +++ b/man3/regex.3
> @@ -179,37 +179,34 @@ .SS Matching
>  .SS Match offsets
>  Unless
>  .B REG_NOSUB
> -was set for the compilation of the pattern buffer, it is possible to
> -obtain match addressing information.
> -.I pmatch
> -must be dimensioned to have at least
> -.I nmatch
> -elements.
> -These are filled in by
> +was passed to
> +.BR regcomp (),
> +it is possible to
> +obtain the locations of matches within
> +.IR string :
>  .BR regexec ()
> -with substring match addresses.
> -The offsets of the subexpression starting at the
> -.IR i th
> -open parenthesis are stored in
> -.IR pmatch[i] .
> -The entire regular expression's match addresses are stored in
> -.IR pmatch[0] .
> -(Note that to return the offsets of
> -.I N
> -subexpression matches,
> +fills
>  .I nmatch
> -must be at least
> -.IR N+1 .)
> -Any unused structure elements will contain the value \-1.
> +elements of
> +.I pmatch
> +with results:
> +.I pmatch[0]
> +corresponds to the entire match,
> +.I pmatch[1]
> +to the first expression, etc.

s/expression/subexpression/?

> +If there were more matches than
> +.IR nmatch ,
> +they are discarded;
> +if fewer,
> +unused elements of
> +.I pmatch
> +are filled with
> +.BR \-1 s.
>  .PP
> -Each
> -.I rm_so
> -element that is not \-1 indicates the start offset of the next largest
> -substring match within the string.
> -The relative
> -.I rm_eo
> -element indicates the end offset of the match,
> -which is the offset of the first character after the matching text.
> +Each returned valid
> +.RB (non- \-1 )
> +match corresponds to the range
> +.RI [ "string + rm_so" , " string + rm_eo" ).
>  .PP
>  .I regoff_t
>  is a signed integer type

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux