From ab3a8b533a824bceba3baf79642745d2b57f4c9d Mon Sep 17 00:00:00 2001 From: mdf Date: Fri, 10 Sep 2010 16:42:16 +0000 Subject: Replace sbuf_overflowed() with sbuf_error(), which returns any error code associated with overflow or with the drain function. While this function is not expected to be used often, it produces more information in the form of an errno that sbuf_overflowed() did. --- share/man/man9/Makefile | 2 +- share/man/man9/sbuf.9 | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'share/man') diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 6abafe1..194eba4 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1025,10 +1025,10 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ sbuf.9 sbuf_data.9 \ sbuf.9 sbuf_delete.9 \ sbuf.9 sbuf_done.9 \ + sbuf.9 sbuf_error.9 \ sbuf.9 sbuf_finish.9 \ sbuf.9 sbuf_len.9 \ sbuf.9 sbuf_new.9 \ - sbuf.9 sbuf_overflowed.9 \ sbuf.9 sbuf_printf.9 \ sbuf.9 sbuf_putc.9 \ sbuf.9 sbuf_set_drain.9 \ diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9 index 7389064..0b6aa90 100644 --- a/share/man/man9/sbuf.9 +++ b/share/man/man9/sbuf.9 @@ -45,7 +45,7 @@ .Nm sbuf_putc , .Nm sbuf_set_drain , .Nm sbuf_trim , -.Nm sbuf_overflowed , +.Nm sbuf_error , .Nm sbuf_finish , .Nm sbuf_data , .Nm sbuf_len , @@ -88,7 +88,7 @@ .Ft int .Fn sbuf_trim "struct sbuf *s" .Ft int -.Fn sbuf_overflowed "struct sbuf *s" +.Fn sbuf_error "struct sbuf *s" .Ft int .Fn sbuf_finish "struct sbuf *s" .Ft char * @@ -332,10 +332,15 @@ function removes trailing whitespace from the .Fa sbuf . .Pp The -.Fn sbuf_overflowed -function returns a non-zero value if the +.Fn sbuf_error +function returns any error value that the +.Fa sbuf +may have accumulated, either from the drain function, or ENOMEM if the .Fa sbuf overflowed. +This function is generally not needed and instead the error code from +.Fn sbuf_finish +is the preferred way to discover whether an sbuf had an error. .Pp The .Fn sbuf_finish @@ -437,9 +442,9 @@ functions all return \-1 if the buffer overflowed, and zero otherwise. .Pp The -.Fn sbuf_overflowed -function -returns a non-zero value if the buffer overflowed, and zero otherwise. +.Fn sbuf_error +function returns a non-zero value if the buffer has an overflow or +drain error, and zero otherwise. .Pp The .Fn sbuf_data -- cgit v1.1