diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-10-18 07:43:58 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-10-18 07:43:58 +0200 |
commit | 385634c8dd512fc4fae46310266247b8fcf2a85a (patch) | |
tree | 46c65697733fea552596c4e1404b0b169015adf1 /src | |
parent | 866844826c3274d1ca8487aaa23dbc3b55c4fa59 (diff) | |
download | coreutils-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')
-rw-r--r-- | src/tac.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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 |