File: ghash_search.c

package info (click to toggle)
bglibs 2.04%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,468 kB
  • sloc: ansic: 15,821; perl: 674; sh: 63; makefile: 29
file content (14 lines) | stat: -rw-r--r-- 333 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "ghash.h"

/** Search for the first entry in the \c ghash table for which the given
 * function returns true. */
void* ghash_search(struct ghash* d, int (*fn)(const void* entry))
{
  void** p;
  unsigned long i;
  for (i = 0, p = d->table; i < d->size; ++i, ++p)
    if (*p != 0)
      if (fn(*p))
	return *p;
  return 0;
}