gbranden pushed a commit to branch master in repository groff. commit 5924bc1c8635a0d572db98593ea314a0fe115a95 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Thu Aug 24 12:14:58 2023 -0500
[eqn]: Migrate `set_param` to `array_size`. * src/preproc/eqn/box.cpp (set_param): Migrate iteration style to use new `array_size()` instead of null pointer guards at the end of an array of structs. --- ChangeLog | 6 ++++++ src/preproc/eqn/box.cpp | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfabc5417..ea412c70d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-08-24 G. Branden Robinson <g.branden.robin...@gmail.com> + + * src/preproc/eqn/box.cpp (set_param): Migrate iteration style + to use new `array_size()` instead of null pointer guards at the + end of an array of structs. + 2023-08-24 G. Branden Robinson <g.branden.robin...@gmail.com> [src]: Add template function for obtaining the length of an diff --git a/src/preproc/eqn/box.cpp b/src/preproc/eqn/box.cpp index a129982e9..a9dc0e01d 100644 --- a/src/preproc/eqn/box.cpp +++ b/src/preproc/eqn/box.cpp @@ -82,7 +82,7 @@ int matrix_side_sep = 17; // = thin space int nroff = 0; // should we grok ndefine or tdefine? -struct S { +struct param { const char *name; int *ptr; } param_table[] = { @@ -126,12 +126,11 @@ struct S { { "body_height", &body_height }, { "body_depth", &body_depth }, { "nroff", &nroff }, - { 0, 0 } }; void set_param(const char *name, int value) { - for (int i = 0; param_table[i].name != 0; i++) + for (size_t i = 0; i < array_size(param_table); i++) if (strcmp(param_table[i].name, name) == 0) { *param_table[i].ptr = value; return; _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit