hcreate(3): fix incorrect claim that hdestroy frees keys
The man page incorrectly stated that hdestroy() calls free(3) for each comparison key. The implementation (hdestroy_r.c) only frees the internal table structure, not the user-provided keys or data. This matches POSIX, which says hdestroy "shall dispose of the search table" without mentioning key deallocation. Update the description to clarify that the caller is responsible for freeing any memory associated with table entries. PR: 291240 Signed-off-by: Kit Dallege <xaum.io@gmail.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/2095
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 6, 2017
|
.Dd June 9, 2026
|
||||||
.Dt HCREATE 3
|
.Dt HCREATE 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -86,10 +86,11 @@ After the call to
|
|||||||
the data can no longer be considered accessible.
|
the data can no longer be considered accessible.
|
||||||
The
|
The
|
||||||
.Fn hdestroy
|
.Fn hdestroy
|
||||||
function calls
|
function disposes of the search table but does not free
|
||||||
.Xr free 3
|
the comparison keys or data items stored in it.
|
||||||
for each comparison key in the search table
|
The caller is responsible for freeing any memory associated
|
||||||
but not the data item associated with the key.
|
with table entries before calling
|
||||||
|
.Fn hdestroy .
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fn hsearch
|
.Fn hsearch
|
||||||
|
|||||||
Reference in New Issue
Block a user