compat: define tfind family of functions regardless of the search.h status

The existence of search.h is not relevant for that. search.h may exist but does
not provide tfind, as on Windows.

If tfind.c is included for compilation, then the code needs to be built.
This commit is contained in:
Steve Lhomme 2023-01-02 16:59:46 +01:00
parent 33dc4d1354
commit 6a46f1152d
2 changed files with 2 additions and 7 deletions

View File

@ -6,9 +6,6 @@
# include <config.h>
#endif
/** search.h is not present so every t* functions has to be implemented */
#ifndef HAVE_SEARCH_H
#include <assert.h>
#include <stdlib.h>
@ -240,5 +237,3 @@ twalk(const void *vroot, cmp_fn_t action) /* Root of the tree to be walked */
if (vroot != NULL && action != NULL)
trecurse(vroot, action, 0);
}
#endif // HAVE_SEARCH_H

View File

@ -481,7 +481,7 @@ ssize_t sendmsg(int, const struct msghdr *, int);
#endif
/* search.h */
#ifndef HAVE_SEARCH_H
#ifndef HAVE_TFIND
typedef enum {
preorder,
postorder,
@ -498,7 +498,7 @@ void twalk( const void *root, void(*action)(const void *nodep, VISIT which, int
void *lfind( const void *key, const void *base, size_t *nmemb,
size_t size, int(*cmp)(const void *, const void *) );
#endif
#endif /* HAVE_SEARCH_H */
#endif /* HAVE_TFIND */
#ifndef HAVE_TDESTROY
void tdestroy( void *root, void (*free_node)(void *nodep) );