From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10981 invoked from network); 4 Oct 2021 14:19:47 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 4 Oct 2021 14:19:47 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 2fa79452 for ; Mon, 4 Oct 2021 09:19:45 -0500 (EST) Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id 7698d5e0 for ; Mon, 4 Oct 2021 09:19:45 -0500 (EST) Date: Mon, 4 Oct 2021 09:19:45 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: store the operating system name obtained from uname(3) in the X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- store the operating system name obtained from uname(3) in the adequate struct together with similar state date rather than in a function-scope static variable, such that it can be free(3)d in roff_man_free(); no functional change Modified Files: -------------- mandoc: mdoc_validate.c roff.c roff_int.h Revision Data ------------- Index: roff_int.h =================================================================== RCS file: /home/cvs/mandoc/mandoc/roff_int.h,v retrieving revision 1.17 retrieving revision 1.18 diff -Lroff_int.h -Lroff_int.h -u -p -r1.17 -r1.18 --- roff_int.h +++ roff_int.h @@ -35,6 +35,7 @@ struct roff_man { struct ohash *mdocmac; /* Mdoc macro lookup table. */ struct ohash *manmac; /* Man macro lookup table. */ const char *os_s; /* Default operating system. */ + char *os_r; /* Operating system name at run time. */ struct roff_node *last; /* The last node parsed. */ struct roff_node *last_es; /* The most recent Es node. */ int quick; /* Abort parse early. */ Index: roff.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/roff.c,v retrieving revision 1.379 retrieving revision 1.380 diff -Lroff.c -Lroff.c -u -p -r1.379 -r1.380 --- roff.c +++ roff.c @@ -1,6 +1,6 @@ /* $Id$ */ /* - * Copyright (c) 2010-2015, 2017-2020 Ingo Schwarze + * Copyright (c) 2010-2015, 2017-2021 Ingo Schwarze * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any @@ -861,6 +861,7 @@ void roff_man_free(struct roff_man *man) { roff_man_free1(man); + free(man->os_r); free(man); } Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mdoc_validate.c,v retrieving revision 1.389 retrieving revision 1.390 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.389 -r1.390 --- mdoc_validate.c +++ mdoc_validate.c @@ -1,6 +1,6 @@ /* $Id$ */ /* - * Copyright (c) 2010-2020 Ingo Schwarze + * Copyright (c) 2010-2021 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010 Joerg Sonnenberger * @@ -2872,7 +2872,6 @@ post_os(POST_ARGS) { #ifndef OSNAME struct utsname utsname; - static char *defbuf; #endif struct roff_node *n; @@ -2909,15 +2908,15 @@ post_os(POST_ARGS) #ifdef OSNAME mdoc->meta.os = mandoc_strdup(OSNAME); #else /*!OSNAME */ - if (defbuf == NULL) { + if (mdoc->os_r == NULL) { if (uname(&utsname) == -1) { mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os"); - defbuf = mandoc_strdup("UNKNOWN"); + mdoc->os_r = mandoc_strdup("UNKNOWN"); } else - mandoc_asprintf(&defbuf, "%s %s", + mandoc_asprintf(&mdoc->os_r, "%s %s", utsname.sysname, utsname.release); } - mdoc->meta.os = mandoc_strdup(defbuf); + mdoc->meta.os = mandoc_strdup(mdoc->os_r); #endif /*!OSNAME*/ out: -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv