mirror of
https://github.com/postgres/postgres.git
synced 2025-05-21 00:02:53 -04:00
Avoid use of bool in thread_test.c
It's not necessary for such a small program, and it causes unnecessary extra work to get the correct definition of bool, more so if we are going to introduce stdbool.h later. Reviewed-by: Thomas Munro <thomas.munro@enterprisedb.com>
This commit is contained in:
parent
77b6b5e9ce
commit
0c4b879b74
@ -22,19 +22,6 @@
|
|||||||
|
|
||||||
#if !defined(IN_CONFIGURE) && !defined(WIN32)
|
#if !defined(IN_CONFIGURE) && !defined(WIN32)
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#else
|
|
||||||
/* From src/include/c.h" */
|
|
||||||
#ifndef bool
|
|
||||||
typedef char bool;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef true
|
|
||||||
#define true ((bool) 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef false
|
|
||||||
#define false ((bool) 0)
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -93,23 +80,23 @@ static volatile int errno2_set = 0;
|
|||||||
#ifndef HAVE_STRERROR_R
|
#ifndef HAVE_STRERROR_R
|
||||||
static char *strerror_p1;
|
static char *strerror_p1;
|
||||||
static char *strerror_p2;
|
static char *strerror_p2;
|
||||||
static bool strerror_threadsafe = false;
|
static int strerror_threadsafe = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(HAVE_GETPWUID_R)
|
#if !defined(WIN32) && !defined(HAVE_GETPWUID_R)
|
||||||
static struct passwd *passwd_p1;
|
static struct passwd *passwd_p1;
|
||||||
static struct passwd *passwd_p2;
|
static struct passwd *passwd_p2;
|
||||||
static bool getpwuid_threadsafe = false;
|
static int getpwuid_threadsafe = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R)
|
#if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R)
|
||||||
static struct hostent *hostent_p1;
|
static struct hostent *hostent_p1;
|
||||||
static struct hostent *hostent_p2;
|
static struct hostent *hostent_p2;
|
||||||
static char myhostname[MAXHOSTNAMELEN];
|
static char myhostname[MAXHOSTNAMELEN];
|
||||||
static bool gethostbyname_threadsafe = false;
|
static int gethostbyname_threadsafe = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool platform_is_threadsafe = true;
|
static int platform_is_threadsafe = 1;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
@ -187,17 +174,17 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifndef HAVE_STRERROR_R
|
#ifndef HAVE_STRERROR_R
|
||||||
if (strerror_p1 != strerror_p2)
|
if (strerror_p1 != strerror_p2)
|
||||||
strerror_threadsafe = true;
|
strerror_threadsafe = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(HAVE_GETPWUID_R)
|
#if !defined(WIN32) && !defined(HAVE_GETPWUID_R)
|
||||||
if (passwd_p1 != passwd_p2)
|
if (passwd_p1 != passwd_p2)
|
||||||
getpwuid_threadsafe = true;
|
getpwuid_threadsafe = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R)
|
#if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R)
|
||||||
if (hostent_p1 != hostent_p2)
|
if (hostent_p1 != hostent_p2)
|
||||||
gethostbyname_threadsafe = true;
|
gethostbyname_threadsafe = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* close down threads */
|
/* close down threads */
|
||||||
@ -218,7 +205,7 @@ main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("not thread-safe. **\n");
|
printf("not thread-safe. **\n");
|
||||||
platform_is_threadsafe = false;
|
platform_is_threadsafe = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -233,7 +220,7 @@ main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("not thread-safe. **\n");
|
printf("not thread-safe. **\n");
|
||||||
platform_is_threadsafe = false;
|
platform_is_threadsafe = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -249,7 +236,7 @@ main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("not thread-safe. **\n");
|
printf("not thread-safe. **\n");
|
||||||
platform_is_threadsafe = false;
|
platform_is_threadsafe = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user