From: millert Date: Fri, 29 Mar 2024 01:01:00 +0000 (+0000) Subject: Call tzset() in main() so we don't need to check TZ repeatedly. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3d209abb55e9230a388b32a1b331fec756dbebdb;p=openbsd Call tzset() in main() so we don't need to check TZ repeatedly. This has the greatest impact on makewhatis, which used to make thousands of calls to issetugid(2) via localtime(3) and strftime(3). Inspired by a different diff from miod@. OK miod@ --- diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index fe8e5a2b1b1..321d6c52167 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.263 2023/09/04 13:08:11 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.264 2024/03/29 01:01:00 millert Exp $ */ /* * Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -391,6 +391,9 @@ main(int argc, char *argv[]) argv += optind; } + /* Avoid repeated TZ lookups, especially for makewhatis. */ + tzset(); + /* * Quirks for help(1) and man(1), * in particular for a section argument without -s.