summaryrefslogtreecommitdiff
path: root/src/libdatastruct/avlnode_search.c
blob: 373f255fa23eb31bfc4d822aaeb4e466a36d3959 (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, uint32_t max, uint32_t r, void const *k, uint32_t *data, dtok_func_ref dtok, cmp_func_ref f, void *p)
{
  uint32_t i = avlnode_searchnode(s, max, r, k, dtok, f, p) ;
  if (i >= max) return (errno = ESRCH, 0) ;
  *data = s[i].data ;
  return 1 ;
}