bglibs: adt: Abstract Data Types.

bglibs

Typedefs | Functions
adt: Abstract Data Types.

## Typedefs
typedef unsigned long | adt_hash_t
typedef void | adt_free_fn(void *)
typedef int | adt_copy_fn(void *, const void *)
typedef int | adt_cmp_fn(const void *, const void *)
typedef adt_hash_t | adt_hash_fn(const void *)

## Functions
adt_hash_t | adt_hashb (const unsigned char *, unsigned long)
adt_hash_t | adt_hashs (const unsigned char *)
adt_hash_t | adt_hashsp (const char *const *)
int | adt_cmpsp (const char *const *a, const char *const *b)
int | adt_copysp (const char **a, const char *const *b)
void | adt_freesp (const char **a)

## Detailed Description

## Typedef Documentation

## ◆ adt_cmp_fn

typedef int adt_cmp_fn(const void *, const void *)

A function prototype for comparing two items. Such functions must return zero if the two items are identical, positive if the first is larger, and negative if the first is smaller.

## ◆ adt_copy_fn

typedef int adt_copy_fn(void *, const void *)

A function prototype for copying something. The function is expected to return false (zero) if the copy failed for any reason (ie could not allocate memory).

## ◆ adt_free_fn

typedef void adt_free_fn(void *)

A function prototype used for freeing something.

## ◆ adt_hash_fn

typedef adt_hash_t adt_hash_fn(const void *)

A function prototype for hasing an item (typically a key).

## ◆ adt_hash_t

typedef unsigned long adt_hash_t

The hash value type. All hash functions must output a value of this type, and all functions that use a hash store it in this type.

## Function Documentation

## ◆ adt_cmpsp()

int adt_cmpsp | ( | const char *const * | a,
|  | const char *const * | b
| ) |  |

A sample function for comparing two C string pointers.

## ◆ adt_copysp()

int adt_copysp | ( | const char ** | a,
|  | const char *const * | b
| ) |  |

A sample function for copying a C string pointer.

## ◆ adt_freesp()

void adt_freesp | ( | const char ** | a | ) |

A sample function for freeing a C string pointer.

## ◆ adt_hashb()

adt_hash_t adt_hashb | ( | const unsigned char * | ,
|  | unsigned | long
| ) |  |

A sample function for hasing a block of memory.

## ◆ adt_hashs()

adt_hash_t adt_hashs | ( | const unsigned char * |  | ) |

A sample function for hashing a C string.

Referenced by adt_hashsp().

## ◆ adt_hashsp()

adt_hash_t adt_hashsp | ( | const char *const * |  | ) |

A sample function for hashing a C string pointer.

References adt_hashs().