Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx> --- man3/regex.3 | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/man3/regex.3 b/man3/regex.3 index ae160c9b3..c5185549b 100644 --- a/man3/regex.3 +++ b/man3/regex.3 @@ -26,7 +26,7 @@ .SH SYNOPSIS .BI " int " eflags ); .PP .BI "size_t regerror(int " errcode ", const regex_t *_Nullable restrict " preg , -.BI " char " errbuf "[restrict ." errbuf_size "], \ +.BI " char " errbuf "[restrict ." errbuf_size "], \ size_t " errbuf_size ); .BI "void regfree(regex_t *" preg ); .fi @@ -207,34 +207,28 @@ .SS Error reporting .BR regexec () into error message strings. .PP -.BR regerror () -is passed the error code, -.IR errcode , -the pattern buffer, -.IR preg , -a pointer to a character string buffer, -.IR errbuf , -and the size of the string buffer, -.IR errbuf_size . -It returns the size of the -.I errbuf -required to contain the null-terminated error message string. -If both -.I errbuf -and +.I errcode +must be the latest error returned from an operation on +.IR preg . +If +.I preg +is a null pointer\(emthe latest error. +.PP +If .I errbuf_size -are nonzero, -.I errbuf -is filled in with the first -.I "errbuf_size \- 1" -characters of the error message and a terminating null byte (\[aq]\e0\[aq]). +is +.BR 0 , +the size of the required buffer is returned. +Otherwise, up to +.I errbuf_size +bytes are copied to +.IR errbuf ; +the error string is always null-terminated, and truncated to fit. .SS Freeing -Supplying .BR regfree () -with a precompiled pattern buffer, -.IR preg , -will free the memory allocated to the pattern buffer by the compiling -process, +invalidates the pattern buffer at +.IR *preg , +which must have been initialized via .BR regcomp (). .SH RETURN VALUE .BR regcomp () -- 2.30.2
Attachment:
signature.asc
Description: PGP signature