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

Commit3f7e1e4

Browse files
author
Michael Meskes
committed
Do not try to change a const variable.
1 parent301194f commit3f7e1e4

File tree

2 files changed

+33
-32
lines changed

2 files changed

+33
-32
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,10 @@ Wed, 26 Nov 2008 14:09:08 +0100
23962396
- When creating a varchar struct name braces must be discarded.
23972397
- Applied patch by Ron Mayer <rm_pg@cheapcomplexdevices.com> to merge
23982398
the new interval style into ecpg.
2399+
2400+
Mon, 15 Dec 2008 16:31:31 +0100
2401+
2402+
- Do not try to change a const variable in ecpg_log.
23992403
- Set pgtypes library version to 3.1.
24002404
- Set compat library version to 3.1.
24012405
- Set ecpg library version to 6.2.

‎src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.44 2008/12/11 07:34:09 petere Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.45 2008/12/15 15:34:07 meskes Exp $ */
22

33
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
@@ -241,49 +241,46 @@ void
241241
ecpg_log(constchar*format,...)
242242
{
243243
va_listap;
244-
structsqlca_t*sqlca=ECPGget_sqlca();
245-
246-
/* internationalize the error message string */
247-
format=ecpg_gettext(format);
248-
249-
if (simple_debug)
250-
{
251-
intbufsize=strlen(format)+100;
252-
char*f= (char*)malloc(bufsize);
244+
structsqlca_t*sqlca=ECPGget_sqlca();
245+
intbufsize=strlen(format)+100;
246+
char*f= (char*)malloc(bufsize),
247+
*intl_format;
253248

254-
if (f==NULL)
255-
return;
249+
if (!simple_debug||f==NULL)
250+
return;
256251

257-
/*
258-
* regression tests set this environment variable to get the same
259-
* output for every run.
260-
*/
261-
if (ecpg_internal_regression_mode)
262-
snprintf(f,bufsize,"[NO_PID]: %s",format);
263-
else
264-
snprintf(f,bufsize,"[%d]: %s", (int)getpid(),format);
252+
/* internationalize the error message string */
253+
intl_format=ecpg_gettext(format);
254+
255+
/*
256+
* regression tests set this environment variable to get the same
257+
* output for every run.
258+
*/
259+
if (ecpg_internal_regression_mode)
260+
snprintf(f,bufsize,"[NO_PID]: %s",intl_format);
261+
else
262+
snprintf(f,bufsize,"[%d]: %s", (int)getpid(),intl_format);
265263

266264
#ifdefENABLE_THREAD_SAFETY
267-
pthread_mutex_lock(&debug_mutex);
265+
pthread_mutex_lock(&debug_mutex);
268266
#endif
269267

270-
va_start(ap,format);
271-
vfprintf(debugstream,f,ap);
272-
va_end(ap);
268+
va_start(ap,format);
269+
vfprintf(debugstream,f,ap);
270+
va_end(ap);
273271

274-
/* dump out internal sqlca variables */
275-
if (ecpg_internal_regression_mode)
276-
fprintf(debugstream,"[NO_PID]: sqlca: code: %ld, state: %s\n",
277-
sqlca->sqlcode,sqlca->sqlstate);
272+
/* dump out internal sqlca variables */
273+
if (ecpg_internal_regression_mode)
274+
fprintf(debugstream,"[NO_PID]: sqlca: code: %ld, state: %s\n",
275+
sqlca->sqlcode,sqlca->sqlstate);
278276

279-
fflush(debugstream);
277+
fflush(debugstream);
280278

281279
#ifdefENABLE_THREAD_SAFETY
282-
pthread_mutex_unlock(&debug_mutex);
280+
pthread_mutex_unlock(&debug_mutex);
283281
#endif
284282

285-
free(f);
286-
}
283+
free(f);
287284
}
288285

289286
void

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp