diff options
Diffstat (limited to 'man3/hsearch.3')
-rw-r--r-- | man3/hsearch.3 | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/man3/hsearch.3 b/man3/hsearch.3 index 72ae4a7e2..dd801dfa3 100644 --- a/man3/hsearch.3 +++ b/man3/hsearch.3 @@ -14,7 +14,7 @@ .\" 2008-09-03, mtk, restructured somewhat, in part after suggestions from .\" Timothy S. Nelson <wayland@wayland.id.au> .\" -.TH hsearch 3 2022-12-15 "Linux man-pages 6.03" +.TH hsearch 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME hcreate, hdestroy, hsearch, hcreate_r, hdestroy_r, hsearch_r \- hash table management @@ -213,41 +213,57 @@ error. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR hcreate (), .BR hsearch (), .BR hdestroy () T} Thread safety MT-Unsafe race:hsearch T{ +.na +.nh .BR hcreate_r (), .BR hsearch_r (), .BR hdestroy_r () T} Thread safety MT-Safe race:htab .TE -.hy -.ad .sp 1 .SH STANDARDS -The functions -.BR hcreate (), -.BR hsearch (), -and +.TP +.BR hcreate () +.TQ +.BR hsearch () +.TQ .BR hdestroy () -are from SVr4, and are described in POSIX.1-2001 and POSIX.1-2008. -.PP -The functions -.BR hcreate_r (), -.BR hsearch_r (), -and +POSIX.1-2008. +.TP +.BR hcreate_r () +.TQ +.BR hsearch_r () +.TQ +.BR hdestroy_r () +GNU. +.SH HISTORY +.TP +.BR hcreate () +.TQ +.BR hsearch () +.TQ +.BR hdestroy () +SVr4, POSIX.1-2001. +.TP +.BR hcreate_r () +.TQ +.BR hsearch_r () +.TQ .BR hdestroy_r () -are GNU extensions. +GNU. .SH NOTES Hash table implementations are usually more efficient when the table contains enough free space to minimize collisions. @@ -291,22 +307,22 @@ some of them. #include <search.h> #include <stdio.h> #include <stdlib.h> - +\& static char *data[] = { "alpha", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliet", "kilo", "lima", "mike", "november", "oscar", "papa", "quebec", "romeo", "sierra", "tango", "uniform", "victor", "whisky", "x\-ray", "yankee", "zulu" }; - +\& int main(void) { ENTRY e; ENTRY *ep; - +\& hcreate(30); - +\& for (size_t i = 0; i < 24; i++) { e.key = data[i]; /* data is just an integer, instead of a @@ -319,7 +335,7 @@ main(void) exit(EXIT_FAILURE); } } - +\& for (size_t i = 22; i < 26; i++) { /* print two entries from the table, and show that two are not in the table */ |