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

Commitfc7a9df

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 parent23a27b0 commitfc7a9df

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
{
@@ -3412,7 +3412,7 @@ get_line_style(const printTableOpt *opt)
34123412
void
34133413
refresh_utf8format(constprintTableOpt*opt)
34143414
{
3415-
printTextFormat*popt=(printTextFormat*)&pg_utf8format;
3415+
printTextFormat*popt=&pg_utf8format;
34163416

34173417
constunicodeStyleBorderFormat*border;
34183418
constunicodeStyleRowFormat*header;

‎src/bin/psql/print.h

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

164164
externconstprintTextFormatpg_asciiformat;
165165
externconstprintTextFormatpg_asciiformat_old;
166-
externconstprintTextFormatpg_utf8format;
166+
externprintTextFormatpg_utf8format;/* ideally would be const, but... */
167167

168168

169169
externvoiddisable_sigpipe_trap(void);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp