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

Commitd318315

Browse files
committed
> Yikes, that is certainly not standard C. I have never seen that
before.> Looks like a GNU-ism. I nice one, but still a GNU-ism.Sorry, I didn't know it is a GNU extension. I have written this patchwhich should fix the problem. Let me know if you still have problems.Massimo Dal Zotto
1 parent9fbaf1d commitd318315

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

‎src/backend/utils/misc/trace.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,34 @@ tprintf(int flag, const char *fmt,...)
129129
return1;
130130
}
131131

132+
/*
133+
* Print a timestamp and a message to stdout or to syslog.
134+
*/
135+
int
136+
tprintf1(constchar*fmt, ... )
137+
{
138+
va_listap;
139+
charline[ELOG_MAXLEN+TIMESTAMP_SIZE+1];
140+
141+
va_start(ap,fmt);
142+
#ifdefELOG_TIMESTAMPS
143+
strcpy(line,tprintf_timestamp());
144+
#endif
145+
vsprintf(line+TIMESTAMP_SIZE,fmt,ap);
146+
va_end(ap);
147+
148+
#ifdefUSE_SYSLOG
149+
write_syslog(LOG_INFO,line+TIMESTAMP_SIZE);
150+
#endif
151+
152+
if (UseSyslog <=1) {
153+
puts(line);
154+
fflush(stdout);
155+
}
156+
157+
return1;
158+
}
159+
132160
/*
133161
* Print a timestamp and a message to stderr.
134162
*/

‎src/include/utils/trace.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ char *tprintf_timestamp(void);
2727
#defineTIMESTAMP_SIZE 0
2828
#endif
2929

30+
externinttprintf1(constchar*fmt, ...);
3031
externinttprintf(intflag,constchar*fmt,...);
3132
externinteprintf(constchar*fmt,...);
3233
externintoption_flag(intflag);
@@ -75,9 +76,15 @@ enum pg_option_enum
7576

7677
externintpg_options[NUM_PG_OPTIONS];
7778

78-
#definePRINTF(args...)tprintf(TRACE_ALL, args)
79-
#defineEPRINTF(args...)eprintf(args)
79+
#ifdef__GNUC__
80+
#definePRINTF(args...)tprintf1(args)
81+
#defineEPRINTF(args...) eprintf(args)
8082
#defineTPRINTF(flag,args...)tprintf(flag, args)
83+
#else
84+
#definePRINTFtprintf1
85+
#defineEPRINTF eprintf
86+
#defineTPRINTFtprintf
87+
#endif
8188

8289
#endif/* TRACE_H */
8390

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp