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

Commit1598dc1

Browse files
committed
Get rid of scribbling on a const variable in psql's print.c.
Commita2dabf0 had the bright idea that it could modify a "const"global variable if it merely casted away const from a pointer. This doesnot work on platforms where the compiler puts "const" variables intoread-only storage. Depressingly, we evidently have no such platforms inour buildfarm ... an oversight I have now remedied. (The one platformthat is known to catch this is recent OS X with -fno-common.)Per report from Chris Ruprecht. Back-patch to 9.5 where the boguscode was introduced.
1 parentc84c87c commit1598dc1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/bin/psql/print.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const printTextFormat pg_asciiformat_old =
9898
};
9999

100100
/* Default unicode linestyle format */
101-
constprintTextFormatpg_utf8format;
101+
printTextFormatpg_utf8format;
102102

103103
typedefstructunicodeStyleRowFormat
104104
{
@@ -3410,7 +3410,7 @@ get_line_style(const printTableOpt *opt)
34103410
void
34113411
refresh_utf8format(constprintTableOpt*opt)
34123412
{
3413-
printTextFormat*popt=(printTextFormat*)&pg_utf8format;
3413+
printTextFormat*popt=&pg_utf8format;
34143414

34153415
constunicodeStyleBorderFormat*border;
34163416
constunicodeStyleRowFormat*header;

‎src/bin/psql/print.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ typedef struct printQueryOpt
164164

165165
externconstprintTextFormatpg_asciiformat;
166166
externconstprintTextFormatpg_asciiformat_old;
167-
externconstprintTextFormatpg_utf8format;
167+
externprintTextFormatpg_utf8format;/* ideally would be const, but... */
168168

169169

170170
externvoiddisable_sigpipe_trap(void);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp