mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 22:40:05 +00:00
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.
This commit is contained in:
parent
482a3be299
commit
2c86b2bc6e
@ -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>
|
1998-09-10 12:51 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* resolv/res_init.c (res_init): Initialize _res.nscount and
|
* resolv/res_init.c (res_init): Initialize _res.nscount and
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -19,6 +19,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
static char tmpnam_buffer[L_tmpnam];
|
||||||
|
|
||||||
/* Generate a unique filename in P_tmpdir.
|
/* Generate a unique filename in P_tmpdir.
|
||||||
|
|
||||||
This function is *not* thread safe! */
|
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
|
/* By using two buffers we manage to be thread safe in the case
|
||||||
where S != NULL. */
|
where S != NULL. */
|
||||||
static char buf[L_tmpnam];
|
|
||||||
char tmpbuf[L_tmpnam];
|
char tmpbuf[L_tmpnam];
|
||||||
|
|
||||||
/* In the following call we use the buffer pointed to by S if
|
/* In the following call we use the buffer pointed to by S if
|
||||||
@ -40,10 +41,7 @@ tmpnam (char *s)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
{
|
return (char *) memcpy (tmpnam_buffer, tmpbuf, L_tmpnam);
|
||||||
memcpy (buf, tmpbuf, L_tmpnam);
|
|
||||||
return buf;
|
return s;
|
||||||
}
|
|
||||||
else
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user