Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c4b879

Browse files
committed
Avoid use of bool in thread_test.c
It's not necessary for such a small program, and it causes unnecessaryextra work to get the correct definition of bool, more so if we aregoing to introduce stdbool.h later.Reviewed-by: Thomas Munro <thomas.munro@enterprisedb.com>
1 parent77b6b5e commit0c4b879

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

‎src/test/thread/thread_test.c

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@
2222

2323
#if !defined(IN_CONFIGURE)&& !defined(WIN32)
2424
#include"postgres.h"
25-
#else
26-
/* From src/include/c.h" */
27-
#ifndefbool
28-
typedefcharbool;
29-
#endif
30-
31-
#ifndeftrue
32-
#definetrue((bool) 1)
33-
#endif
34-
35-
#ifndeffalse
36-
#definefalse((bool) 0)
37-
#endif
3825
#endif
3926

4027
#include<stdio.h>
@@ -93,23 +80,23 @@ static volatile int errno2_set = 0;
9380
#ifndefHAVE_STRERROR_R
9481
staticchar*strerror_p1;
9582
staticchar*strerror_p2;
96-
staticboolstrerror_threadsafe=false;
83+
staticintstrerror_threadsafe=0;
9784
#endif
9885

9986
#if !defined(WIN32)&& !defined(HAVE_GETPWUID_R)
10087
staticstructpasswd*passwd_p1;
10188
staticstructpasswd*passwd_p2;
102-
staticboolgetpwuid_threadsafe=false;
89+
staticintgetpwuid_threadsafe=0;
10390
#endif
10491

10592
#if !defined(HAVE_GETADDRINFO)&& !defined(HAVE_GETHOSTBYNAME_R)
10693
staticstructhostent*hostent_p1;
10794
staticstructhostent*hostent_p2;
10895
staticcharmyhostname[MAXHOSTNAMELEN];
109-
staticboolgethostbyname_threadsafe=false;
96+
staticintgethostbyname_threadsafe=0;
11097
#endif
11198

112-
staticboolplatform_is_threadsafe=true;
99+
staticintplatform_is_threadsafe=1;
113100

114101
int
115102
main(intargc,char*argv[])
@@ -187,17 +174,17 @@ main(int argc, char *argv[])
187174

188175
#ifndefHAVE_STRERROR_R
189176
if (strerror_p1!=strerror_p2)
190-
strerror_threadsafe=true;
177+
strerror_threadsafe=1;
191178
#endif
192179

193180
#if !defined(WIN32)&& !defined(HAVE_GETPWUID_R)
194181
if (passwd_p1!=passwd_p2)
195-
getpwuid_threadsafe=true;
182+
getpwuid_threadsafe=1;
196183
#endif
197184

198185
#if !defined(HAVE_GETADDRINFO)&& !defined(HAVE_GETHOSTBYNAME_R)
199186
if (hostent_p1!=hostent_p2)
200-
gethostbyname_threadsafe=true;
187+
gethostbyname_threadsafe=1;
201188
#endif
202189

203190
/* close down threads */
@@ -218,7 +205,7 @@ main(int argc, char *argv[])
218205
else
219206
{
220207
printf("not thread-safe. **\n");
221-
platform_is_threadsafe=false;
208+
platform_is_threadsafe=0;
222209
}
223210
#endif
224211

@@ -233,7 +220,7 @@ main(int argc, char *argv[])
233220
else
234221
{
235222
printf("not thread-safe. **\n");
236-
platform_is_threadsafe=false;
223+
platform_is_threadsafe=0;
237224
}
238225
#endif
239226

@@ -249,7 +236,7 @@ main(int argc, char *argv[])
249236
else
250237
{
251238
printf("not thread-safe. **\n");
252-
platform_is_threadsafe=false;
239+
platform_is_threadsafe=0;
253240
}
254241
#endif
255242

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp