]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: make tac.c slightly cleaner
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 18 Oct 2011 05:43:58 +0000 (07:43 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 18 Oct 2011 05:43:58 +0000 (07:43 +0200)
* src/tac.c (copy_to_temp): Now that the template string tacXXXXXX
is used in only one place, don't bother using a separate variable.
Also, using three unconditional assignments seems slightly clearer.

src/tac.c

index 97b19aec7da75dc10046b0382337a83de0e91dae..7d99595e2f39040288c6051f8ee92f16cde2c641 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -430,12 +430,9 @@ copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
 
   if (template == NULL)
     {
-      char const * const Template = "tacXXXXXX";
-      tempdir = getenv ("TMPDIR");
-      if (tempdir == NULL)
-        tempdir = DEFAULT_TMPDIR;
-
-      template = file_name_concat (tempdir, Template, NULL);
+      char *t = getenv ("TMPDIR");
+      tempdir = t ? t : DEFAULT_TMPDIR;
+      template = file_name_concat (tempdir, "tacXXXXXX", NULL);
     }
 
   /* FIXME: there's a small window between a successful mkstemp call