The @code{lfind} function searches in the array with @code{*@var{nmemb}}
elements of @var{size} bytes pointed to by @var{base} for an element
which matches the one pointed to by @var{key}. The function pointed to
-by @var{compar} is used decide whether two elements match.
+by @var{compar} is used to decide whether two elements match.
The return value is a pointer to the matching element in the array
starting at @var{base} if it is found. If no matching element is
hashing table used through the whole program. The table is allocated
in local memory out of control of the programmer. As an extension @theglibc{}
provides an additional set of functions with a reentrant
-interface which provide a similar interface but which allow to keep
+interface which provides a similar interface but which allows keeping
arbitrarily many hashing tables.
It is possible to use more than one hashing table in the program run if
the former table is first destroyed by a call to @code{hdestroy}.
-The function returns a non-zero value if successful. If it return zero
+The function returns a non-zero value if successful. If it returns zero,
something went wrong. This could either mean there is already a hashing
-table in use or the program runs out of memory.
+table in use or the program ran out of memory.
@end deftypefun
@comment search.h
programmer has to keep a list of all table elements and before calling
@code{hdestroy} s/he has to free all element's data using this list.
This is a very unpleasant mechanism and it also shows that this kind of
-hashing tables is mainly meant for tables which are created once and
+hashing table is mainly meant for tables which are created once and
used until the end of the program run.
@end deftypefun
@c hsearch @mtasurace:hsearch @acucorrupt/action==ENTER
@c hsearch_r dup @mtsrace:htab @acucorrupt/action==ENTER
To search in a hashing table created using @code{hcreate} the
-@code{hsearch} function must be used. This function can perform simple
-search for an element (if @var{action} has the @code{FIND}) or it can
+@code{hsearch} function must be used. This function can perform a simple
+search for an element (if @var{action} has the value @code{FIND}) or it can
alternatively insert the key element into the hashing table. Entries
are never replaced.
locating the corresponding position in the hashing table only the
@code{key} element of the structure is used.
-If an entry with matching key is found the @var{action} parameter is
+If an entry with a matching key is found the @var{action} parameter is
irrelevant. The found entry is returned. If no matching entry is found
and the @var{action} parameter has the value @code{FIND} the function
returns a @code{NULL} pointer. If no entry is found and the
A pointer to the newly added entry is returned.
@end deftypefun
-As mentioned before the hashing table used by the functions described so
+As mentioned before, the hashing table used by the functions described so
far is global and there can be at any time at most one hashing table in
the program. A solution is to use the following functions which are a
GNU extension. All have in common that they operate on a hashing table
The return value is non-zero if the operation was successful. If the
return value is zero, something went wrong, which probably means the
-programs ran out of memory.
+program ran out of memory.
@end deftypefun
@comment search.h
@c free dup @ascuheap @acsmem
The @code{hdestroy_r} function frees all resources allocated by the
@code{hcreate_r} function for this very same object @var{htab}. As for
-@code{hdestroy} it is the programs responsibility to free the strings
+@code{hdestroy} it is the program's responsibility to free the strings
for the elements of the table.
@end deftypefun
initialized by a call to @code{hcreate_r}).
Another difference to @code{hcreate} is that the pointer to the found
-entry in the table is not the return value of the functions. It is
-returned by storing it in a pointer variables pointed to by the
+entry in the table is not the return value of the function. It is
+returned by storing it in a pointer variable pointed to by the
@var{retval} parameter. The return value of the function is an integer
value indicating success if it is non-zero and failure if it is zero.
In the latter case the global variable @var{errno} signals the reason for
constant pointer). Instead the function returns @code{NULL}.
@end deftypefun
-Another advantage of the @code{tsearch} function in contrast to the
+Another advantage of the @code{tsearch} functions in contrast to the
@code{hsearch} functions is that there is an easy way to remove
elements.
@safety{@prelim{}@mtsafe{}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}}
If the complete search tree has to be removed one can use
@code{tdestroy}. It frees all resources allocated by the @code{tsearch}
-function to generate the tree pointed to by @var{vroot}.
+functions to generate the tree pointed to by @var{vroot}.
For the data in each tree node the function @var{freefct} is called.
The pointer to the data is passed as the argument to the function. If
X/Open specifications.
@end deftypefun
-In addition to the function to create and destroy the tree data
+In addition to the functions to create and destroy the tree data
structure, there is another function which allows you to apply a
function to all elements of the tree. The function must have this type:
@var{value} set to @code{leaf}. For internal nodes the function is
called three times, setting the @var{value} parameter or @var{action} to
the appropriate value. The @var{level} argument for the @var{action}
-function is computed while descending the tree with increasing the value
-by one for the descend to a child, starting with the value @math{0} for
+function is computed while descending the tree by increasing the value
+by one for each descent to a child, starting with the value @math{0} for
the root node.
Since the functions used for the @var{action} parameter to @code{twalk}