summaryrefslogtreecommitdiff
path: root/src/libdatastruct/avlnode_search.c
blob: e12b0a4920c11d7e20ffb03aba9faf9548900eae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <errno.h>
#include <skalibs/avlnode.h>

int avlnode_search (avlnode const *s, unsigned int max, unsigned int r, void const *k, unsigned int *data, dtokfunc_t_ref dtok, cmpfunc_t_ref f, void *p)
{
  register unsigned int i = avlnode_searchnode(s, max, r, k, dtok, f, p) ;
  if (i >= max) return (errno = ESRCH, 0) ;
  *data = s[i].data ;
  return 1 ;
}