Mercurial > ~dholland > hg > ag > index.cgi
changeset 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 | ec2b657edf13 |
children | 5b21f127e957 |
files | help2html/array.c help2html/array.h help2html/uintarray.c help2html/uintarray.h |
diffstat | 4 files changed, 24 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/help2html/array.c Mon May 30 23:51:43 2022 -0400 +++ b/help2html/array.c Mon May 30 23:56:45 2022 -0400 @@ -33,8 +33,13 @@ * I wish there were a way to check that these were the same as the * inline versions, but apparently allowing such things to diverge is * a feature of C99. Bleh. + * + * Update: it all broke anyway, so I've switched to static inline as + * an expedient. Thus, at least for the time being, we don't need the + * extra copies. */ +#if 0 unsigned array_num(const struct array *a) { return a->num; } @@ -48,6 +53,7 @@ assert(ix < a->num); a->v[ix] = ptr; } +#endif ////////////////////////////////////////////////////////////
--- a/help2html/array.h Mon May 30 23:51:43 2022 -0400 +++ b/help2html/array.h Mon May 30 23:56:45 2022 -0400 @@ -11,9 +11,9 @@ void array_cleanup(struct array *a); void array_destroy(struct array *a); -unsigned array_num(const struct array *a); -void *array_get(const struct array *a, unsigned ix); -void array_set(struct array *a, unsigned ix, void *ptr); +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); @@ -23,16 +23,16 @@ /* x and y are pointers that were placed in the array */ void array_sort(struct array *a, int (*f)(void *x, void *y)); -extern inline unsigned array_num(const struct array *a) { +static inline unsigned array_num(const struct array *a) { return a->num; } -extern inline void *array_get(const struct array *a, unsigned ix) { +static inline void *array_get(const struct array *a, unsigned ix) { assert(ix < a->num); return a->v[ix]; } -extern inline void array_set(struct array *a, unsigned ix, void *ptr) { +static inline void array_set(struct array *a, unsigned ix, void *ptr) { assert(ix < a->num); a->v[ix] = ptr; }
--- a/help2html/uintarray.c Mon May 30 23:51:43 2022 -0400 +++ b/help2html/uintarray.c Mon May 30 23:56:45 2022 -0400 @@ -33,8 +33,13 @@ * I wish there were a way to check that these were the same as the * inline versions, but apparently allowing such things to diverge is * a feature of C99. Bleh. + * + * Update: it all broke anyway, so I've switched to static inline as + * an expedient. Thus, at least for the time being, we don't need the + * extra copies. */ +#if 0 unsigned uintarray_num(const struct uintarray *a) { return a->num; } @@ -48,6 +53,7 @@ assert(ix < a->num); a->v[ix] = val; } +#endif ////////////////////////////////////////////////////////////
--- a/help2html/uintarray.h Mon May 30 23:51:43 2022 -0400 +++ b/help2html/uintarray.h Mon May 30 23:56:45 2022 -0400 @@ -11,25 +11,25 @@ void uintarray_cleanup(struct uintarray *a); void uintarray_destroy(struct uintarray *a); -unsigned uintarray_num(const struct uintarray *a); -unsigned uintarray_get(const struct uintarray *a, unsigned ix); -void uintarray_set(struct uintarray *a, unsigned ix, unsigned val); +static inline unsigned uintarray_num(const struct uintarray *a); +static inline unsigned uintarray_get(const struct uintarray *a, unsigned ix); +static inline void uintarray_set(struct uintarray *a, unsigned ix, unsigned val); void uintarray_add(struct uintarray *a, unsigned val); void uintarray_setsize(struct uintarray *a, unsigned newsize); /* x and y are pointers that were placed in the uintarray */ void uintarray_sort(struct uintarray *a, int (*f)(unsigned x, unsigned y)); -extern inline unsigned uintarray_num(const struct uintarray *a) { +static inline unsigned uintarray_num(const struct uintarray *a) { return a->num; } -extern inline unsigned uintarray_get(const struct uintarray *a, unsigned ix) { +static inline unsigned uintarray_get(const struct uintarray *a, unsigned ix) { assert(ix < a->num); return a->v[ix]; } -extern inline void uintarray_set(struct uintarray *a, unsigned ix, +static inline void uintarray_set(struct uintarray *a, unsigned ix, unsigned val) { assert(ix < a->num); a->v[ix] = val;