]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Thu, 10 Sep 1998 13:11:25 +0000 (13:11 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 10 Sep 1998 13:11:25 +0000 (13:11 +0000)
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.

ChangeLog
stdio-common/tmpnam.c

index 1c7c70024966c045ab0f8914b6f4a86e8e3f903a..64054b58f788e2f8388c489cd03036dd48aeb674 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
 1998-09-10 12:51  Ulrich Drepper  <drepper@cygnus.com>
 
        * resolv/res_init.c (res_init): Initialize _res.nscount and
index e5c6bf166d81ae1c955a671e291e6fd9c6f58848..0bbb318953196f820436101d087bade9932dcf80 100644 (file)
@@ -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;
 }