2323.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2424.\" SUCH DAMAGE.
2525.\"
26- .Dd June 18, 2018
26+ .Dd January 3, 2025
2727.Dt CNV 9
2828.Os
2929.Sh NAME
3030.Nm cnvlist_get ,
3131.Nm cnvlist_take ,
3232.Nm cnvlist_free
33- .Nd " API for managing name/value pairs by cookie. "
33+ .Nd " API for managing name/value pairs by cookie"
3434.Sh LIBRARY
3535.Lb libnv
3636.Sh SYNOPSIS
115115.Nm libnv
116116library permits easy management of name/value pairs and can send and receive
117117them over sockets.
118- For more information, also see
118+ For more information, see
119119.Xr nv 9 .
120120.Pp
121121The concept of cookies is explained in
@@ -128,44 +128,50 @@ from
128128.Pp
129129The
130130.Fn cnvlist_name
131- function returns the name of an element associated with the given cookie.
131+ function returns the name of an element associated with
132+ .Fa cookie .
132133.Pp
133134The
134135.Fn cnvlist_type
135- function returns the type of an element associated with the given cookie.
136+ function returns the type of an element associated with
137+ .Fa cookie .
136138Types which can be returned are described in
137139.Xr nv 9 .
138140.Pp
139141The
140142.Nm cnvlist_get
141- family of functions obtains the value associated with the given cookie.
143+ functions return the value associated with
144+ .Fa cookie .
142145Returned strings, nvlists, descriptors, binaries, or arrays must not be modified
143- by the user, since they still belong to the nvlist.
146+ by the user since they still belong to the nvlist.
144147The nvlist must not be in an error state.
145148.Pp
146149The
147150.Nm cnvlist_take
148- family of functions returns the value associated with the given cookie and
149- removes the element from the nvlist.
151+ functions return the value associated with the given cookie and
152+ remove the element from the nvlist.
150153When the value is a string, binary, or array value, the caller is responsible
151154for freeing the returned memory with
152155.Fn free 3 .
153156When the value is an nvlist, the caller is responsible for destroying the
154157returned nvlist with
155158.Fn nvlist_destroy .
156159When the value is a descriptor, the caller is responsible for closing the
157- returned descriptor with the
160+ returned descriptor with
158161.Fn close 2 .
159162.Pp
160163The
161164.Nm cnvlist_free
162- family of functions removes an element of the supplied cookie and frees all
163- resources.
164- If an element of the given cookie has the wrong type or does not exist, the
165+ functions remove the element identified by
166+ .Fa cookie
167+ and free any associated resources.
168+ If the element identified by
169+ .Fa cookie
170+ has the wrong type or does not exist, the
165171program
166- is aborted .
172+ aborts .
167173.Sh EXAMPLES
168- The following example demonstrates how to deal with cnvlist API.
174+ The following example demonstrates how to deal with the cnvlist API.
169175.Bd -literal
170176int type;
171177void *cookie, *scookie, *bcookie;
0 commit comments