aboutsummaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-10 13:11:25 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-10 13:11:25 +0000
commit2c86b2bc6e6b28dc8c6bf0384e90d1eb4a05af8d (patch)
treec93987888e1343d46228326ae887cab55fb8b480 /stdio-common
parent482a3be2990e5d2778b3d7b339cbb1d4cda43dae (diff)
downloadglibc-2c86b2bc6e6b28dc8c6bf0384e90d1eb4a05af8d.zip
glibc-2c86b2bc6e6b28dc8c6bf0384e90d1eb4a05af8d.tar.gz
glibc-2c86b2bc6e6b28dc8c6bf0384e90d1eb4a05af8d.tar.bz2
Update.
1998-09-10 Ulrich Drepper <drepper@cygnus.com> * stdio-common/tmpnam.c: Move local static variable buf to toplevel and rename to tmpnam_buffer to ease debugging. Patch by Joe Keane <jgk@jgk.org>. Optimize s == NULL case a bit.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/tmpnam.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/stdio-common/tmpnam.c b/stdio-common/tmpnam.c
index e5c6bf1..0bbb318 100644
--- a/stdio-common/tmpnam.c
+++ b/stdio-common/tmpnam.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,8 @@
#include <stdio.h>
#include <string.h>
+static char tmpnam_buffer[L_tmpnam];
+
/* Generate a unique filename in P_tmpdir.
This function is *not* thread safe! */
@@ -27,7 +29,6 @@ tmpnam (char *s)
{
/* By using two buffers we manage to be thread safe in the case
where S != NULL. */
- static char buf[L_tmpnam];
char tmpbuf[L_tmpnam];
/* In the following call we use the buffer pointed to by S if
@@ -40,10 +41,7 @@ tmpnam (char *s)
return NULL;
if (s == NULL)
- {
- memcpy (buf, tmpbuf, L_tmpnam);
- return buf;
- }
- else
- return s;
+ return (char *) memcpy (tmpnam_buffer, tmpbuf, L_tmpnam);
+
+ return s;
}