summaryrefslogtreecommitdiff
path: root/src/tac.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-10-18 07:43:58 +0200
committerJim Meyering <meyering@redhat.com>2011-10-18 07:43:58 +0200
commit385634c8dd512fc4fae46310266247b8fcf2a85a (patch)
tree46c65697733fea552596c4e1404b0b169015adf1 /src/tac.c
parent866844826c3274d1ca8487aaa23dbc3b55c4fa59 (diff)
downloadcoreutils-385634c8dd512fc4fae46310266247b8fcf2a85a.tar.xz
maint: make tac.c slightly cleaner
* 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.
Diffstat (limited to 'src/tac.c')
-rw-r--r--src/tac.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/tac.c b/src/tac.c
index 97b19aec7..7d99595e2 100644
--- 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