Mercurial > ~dholland > hg > ag > index.cgi
comparison help2html/array.h @ 9:60b08b68c750
Switch to static inline as an expedient build fix.
Should probably set this up with working C99 inline but for the moment
I don't have the energy.
author | David A. Holland |
---|---|
date | Mon, 30 May 2022 23:56:45 -0400 |
parents | 13d2b8934445 |
children |
comparison
equal
deleted
inserted
replaced
8:ec2b657edf13 | 9:60b08b68c750 |
---|---|
9 struct array *array_create(void); | 9 struct array *array_create(void); |
10 void array_init(struct array *a); | 10 void array_init(struct array *a); |
11 void array_cleanup(struct array *a); | 11 void array_cleanup(struct array *a); |
12 void array_destroy(struct array *a); | 12 void array_destroy(struct array *a); |
13 | 13 |
14 unsigned array_num(const struct array *a); | 14 static inline unsigned array_num(const struct array *a); |
15 void *array_get(const struct array *a, unsigned ix); | 15 static inline void *array_get(const struct array *a, unsigned ix); |
16 void array_set(struct array *a, unsigned ix, void *ptr); | 16 static inline void array_set(struct array *a, unsigned ix, void *ptr); |
17 unsigned array_add(struct array *a, void *ptr); | 17 unsigned array_add(struct array *a, void *ptr); |
18 void array_setsize(struct array *a, unsigned newsize); | 18 void array_setsize(struct array *a, unsigned newsize); |
19 | 19 |
20 /* compact, removing any null elements */ | 20 /* compact, removing any null elements */ |
21 void array_nonulls(struct array *a); | 21 void array_nonulls(struct array *a); |
22 | 22 |
23 /* x and y are pointers that were placed in the array */ | 23 /* x and y are pointers that were placed in the array */ |
24 void array_sort(struct array *a, int (*f)(void *x, void *y)); | 24 void array_sort(struct array *a, int (*f)(void *x, void *y)); |
25 | 25 |
26 extern inline unsigned array_num(const struct array *a) { | 26 static inline unsigned array_num(const struct array *a) { |
27 return a->num; | 27 return a->num; |
28 } | 28 } |
29 | 29 |
30 extern inline void *array_get(const struct array *a, unsigned ix) { | 30 static inline void *array_get(const struct array *a, unsigned ix) { |
31 assert(ix < a->num); | 31 assert(ix < a->num); |
32 return a->v[ix]; | 32 return a->v[ix]; |
33 } | 33 } |
34 | 34 |
35 extern inline void array_set(struct array *a, unsigned ix, void *ptr) { | 35 static inline void array_set(struct array *a, unsigned ix, void *ptr) { |
36 assert(ix < a->num); | 36 assert(ix < a->num); |
37 a->v[ix] = ptr; | 37 a->v[ix] = ptr; |
38 } | 38 } |