pointtools

Simple point utilities to hold text presentations.
git clone git://r-36.net/pointtools
Log | Files | Refs | LICENSE

commit 44f42507f8b54d6f3c96869275077ee39dae18d8
parent 0e58fcdb306d8383ead9eafdcd6666515a44ab50
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed, 29 Apr 2020 19:31:59 +0200

fprintunderline: small optimization

Don't run utf8strlen potentially for each character.

Signed-off-by: Christoph Lohmann <20h@r-36.net>

Diffstat:
md2point.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/md2point.c b/md2point.c @@ -25,10 +25,11 @@ utf8strlen(const char *s) void fprintunderline(FILE *fp, const char *str) { - size_t i; + size_t i, len; fprintf(fp, "\n %s\n ", str); - for (i = 0; i <= utf8strlen(str); ++i) + len = utf8strlen(str); + for (i = 0; i <= len; ++i) fputs("=", fp); fputs("\n\n", fp); }