]> git.draconx.ca Git - dxcommon.git/commit
help_print_optstring: New table-based implementation.
authorNick Bowler <nbowler@draconx.ca>
Tue, 5 Dec 2023 02:16:36 +0000 (21:16 -0500)
committerNick Bowler <nbowler@draconx.ca>
Tue, 5 Dec 2023 03:58:27 +0000 (22:58 -0500)
commitac9f1d42b0caa9411e4e8e493c9919c1aaa9ac4f
tree9ea4cbe5e6b80ab211dcb997fa315329fa7d1cbf
parentf7845ef1698291a23975052a100c12bf38a0664d
help_print_optstring: New table-based implementation.

By moving the format strings into a single table and a table-based
lookup to select the matching string, we can drastically simplify
the control flow in this function.

This results in about a ~35% code size reduction compiled with gcc.

The tables are generated using gen-strtab.awk but we manually copy
it into the source file, as downstream users just pick out help.c
and help.h by themselves.
src/help-glo.str [new file with mode: 0644]
src/help-std.str [new file with mode: 0644]
src/help.c
t/nls/gettext.h