Index | Thread | Search

From:
Jan Stary <hans@stare.cz>
Subject:
Re: drop a useless function
To:
tech@openbsd.org
Date:
Tue, 8 Apr 2025 10:21:18 +0200

Download raw body.

Thread
On Apr 08 09:09:07, florian@openbsd.org wrote:
> the comment right above it should go as well.
> 
> On 2025-04-07 21:20 +02, Jan Stary <hans@stare.cz> wrote:
> > The tformat() function in zdump.c
> > merely returns a constant string
> > and is called once.

Thanks for checking the diff.

I left that in, thinking it applies to all "code below"
i.e. also dumptime(), being the tail of zdump.c - but
perhaps it's just the "%lld" that was meant by then.

(And perhaps a comment making a statement about
"all known systems as of 2004" should go at any rate :-)

Updated diff below.

	Jan


Index: zdump.c
===================================================================
RCS file: /cvs/src/usr.sbin/zdump/zdump.c,v
diff -u -p -r1.14 zdump.c
--- zdump.c	15 Mar 2016 19:50:48 -0000	1.14
+++ zdump.c	8 Apr 2025 08:19:27 -0000
@@ -62,7 +62,6 @@ static void		dumptime(const struct tm *t
 static time_t		hunt(char *name, time_t lot, time_t	hit);
 static void		setabsolutes(void);
 static void		show(char *zone, time_t t, int v);
-static const char 	*tformat(void);
 static time_t		yeartot(long y);
 static void		usage(void);
 
@@ -358,7 +357,7 @@ show(char *zone, time_t t, int v)
 	if (v) {
 		tmp = gmtime(&t);
 		if (tmp == NULL) {
-			printf(tformat(), t);
+			printf("%lld", t);
 		} else {
 			dumptime(tmp);
 			printf(" UTC");
@@ -392,17 +391,6 @@ abbr(struct tm *tmp)
 		return &nada;
 	result = tzname[tmp->tm_isdst];
 	return (result == NULL) ? &nada : result;
-}
-
-/*
-** The code below can fail on certain theoretical systems;
-** it works on all known real-world systems as of 2004-12-30.
-*/
-
-static const char *
-tformat(void)
-{
-	return "%lld";
 }
 
 static void