Loading...
Searching...
No Matches
Vectors

Helpers for vectors manipulation. More...

## Typedefs

typedef void(* | ec_vec_elt_free_t) (void *ptr)
| Custom free callback.
typedef void(* | ec_vec_elt_copy_t) (void *dst, void *src)
| Custom copy callback.

## Functions

struct ec_vec * | ec_vec (size_t elt_size, size_t size, ec_vec_elt_copy_t copy, ec_vec_elt_free_t free)
| Create a new vector.
int | ec_vec_add_by_ref (struct ec_vec *vec, void *ptr)
| Add reference to a vector.
int | ec_vec_add_ptr (struct ec_vec *vec, void *elt)
| Add opaque element to a vector.
int | ec_vec_add_u8 (struct ec_vec *vec, uint8_t elt)
| Add uint8_t value to a vector.
int | ec_vec_add_u16 (struct ec_vec *vec, uint16_t elt)
| Add uint16_t value to a vector.
int | ec_vec_add_u32 (struct ec_vec *vec, uint32_t elt)
| Add uint32_t value to a vector.
int | ec_vec_add_u64 (struct ec_vec *vec, uint64_t elt)
| Add uint64_t value to a vector.
int | ec_vec_get (void *ptr, const struct ec_vec *vec, size_t idx)
| Get element located at an offset.
struct ec_vec * | ec_vec_dup (const struct ec_vec *vec)
| Duplicate a vector.
struct ec_vec * | ec_vec_ndup (const struct ec_vec *vec, size_t off, size_t len)
| Duplicate a portion of a vector.
void | ec_vec_free (struct ec_vec *vec)
| Free a vector and all its contents.

## Detailed Description

Helpers for vectors manipulation.

The ec_vec API provides helpers to manipulate vectors of objects of any kind.

## Typedef Documentation

## ec_vec_elt_free_t

typedef void(* ec_vec_elt_free_t) (void *ptr)

Custom free callback.

If NULL, the default does nothing.

Definition at line 25 of file vec.h.

## ec_vec_elt_copy_t

typedef void(* ec_vec_elt_copy_t) (void *dst, void *src)

Custom copy callback.

If NULL, the default is: memcpy(dst, src, vec->elt_size).

Definition at line 32 of file vec.h.