Mercurial > ~dholland > hg > ag > index.cgi
view help2html/array.h @ 22:5581ef01f993
Regen all the AG output.
This also fixes the line number output in the tools
(cgbigen/helpgen/help2html), apparently because those files weren't
regenerated last go.
author | David A. Holland |
---|---|
date | Mon, 13 Jun 2022 00:06:39 -0400 |
parents | 60b08b68c750 |
children |
line wrap: on
line source
#include <assert.h> /* treat as opaque */ struct array { void **v; unsigned num, max; }; struct array *array_create(void); void array_init(struct array *a); void array_cleanup(struct array *a); void array_destroy(struct array *a); static inline unsigned array_num(const struct array *a); static inline void *array_get(const struct array *a, unsigned ix); static inline void array_set(struct array *a, unsigned ix, void *ptr); unsigned array_add(struct array *a, void *ptr); void array_setsize(struct array *a, unsigned newsize); /* compact, removing any null elements */ void array_nonulls(struct array *a); /* x and y are pointers that were placed in the array */ void array_sort(struct array *a, int (*f)(void *x, void *y)); static inline unsigned array_num(const struct array *a) { return a->num; } static inline void *array_get(const struct array *a, unsigned ix) { assert(ix < a->num); return a->v[ix]; } static inline void array_set(struct array *a, unsigned ix, void *ptr) { assert(ix < a->num); a->v[ix] = ptr; }