mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 05:50:26 +02:00
* mkstemp.c: #include <config.h> if HAVE_CONFIG_H. #include
"libguile/__scm.h". Remove definition of gcc_uint64_t in favor of scm_t_uint64 and rename usages.
This commit is contained in:
parent
0261dfae16
commit
2a7b258316
1 changed files with 8 additions and 11 deletions
|
@ -41,7 +41,11 @@
|
||||||
whether to permit this exception to apply to your modifications.
|
whether to permit this exception to apply to your modifications.
|
||||||
If you do not wish that, delete this exception notice. */
|
If you do not wish that, delete this exception notice. */
|
||||||
|
|
||||||
#include "libguile/scmconfig.h"
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "libguile/__scm.h"
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -62,13 +66,6 @@
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We need to provide a type for gcc_uint64_t. */
|
|
||||||
#ifdef __GNUC__
|
|
||||||
typedef unsigned long long gcc_uint64_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned long gcc_uint64_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TMP_MAX
|
#ifndef TMP_MAX
|
||||||
#define TMP_MAX 16384
|
#define TMP_MAX 16384
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,7 +86,7 @@ mkstemp (template)
|
||||||
{
|
{
|
||||||
static const char letters[]
|
static const char letters[]
|
||||||
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
static gcc_uint64_t value;
|
static scm_t_uint64 value;
|
||||||
#ifdef HAVE_GETTIMEOFDAY
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
#endif
|
#endif
|
||||||
|
@ -110,14 +107,14 @@ mkstemp (template)
|
||||||
#ifdef HAVE_GETTIMEOFDAY
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
/* Get some more or less random data. */
|
/* Get some more or less random data. */
|
||||||
gettimeofday (&tv, NULL);
|
gettimeofday (&tv, NULL);
|
||||||
value += ((gcc_uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
|
value += ((scm_t_uint64) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
|
||||||
#else
|
#else
|
||||||
value += getpid ();
|
value += getpid ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (count = 0; count < TMP_MAX; ++count)
|
for (count = 0; count < TMP_MAX; ++count)
|
||||||
{
|
{
|
||||||
gcc_uint64_t v = value;
|
scm_t_uint64 v = value;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
/* Fill in the random bits. */
|
/* Fill in the random bits. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue