Skip to content

Commit fc7a9df

Browse files
committed
Get rid of scribbling on a const variable in psql's print.c.
Commit a2dabf0 had the bright idea that it could modify a "const" global variable if it merely casted away const from a pointer. This does not work on platforms where the compiler puts "const" variables into read-only storage. Depressingly, we evidently have no such platforms in our buildfarm ... an oversight I have now remedied. (The one platform that is known to catch this is recent OS X with -fno-common.) Per report from Chris Ruprecht. Back-patch to 9.5 where the bogus code was introduced.
1 parent 23a27b0 commit fc7a9df

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-
const printTextFormat pg_utf8format;
101+
printTextFormat pg_utf8format;
102102

103103
typedef struct unicodeStyleRowFormat
104104
{
@@ -3412,7 +3412,7 @@ get_line_style(const printTableOpt *opt)
34123412
void
34133413
refresh_utf8format(const printTableOpt *opt)
34143414
{
3415-
printTextFormat *popt = (printTextFormat *) &pg_utf8format;
3415+
printTextFormat *popt = &pg_utf8format;
34163416

34173417
const unicodeStyleBorderFormat *border;
34183418
const unicodeStyleRowFormat *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
extern const printTextFormat pg_asciiformat;
165165
extern const printTextFormat pg_asciiformat_old;
166-
extern const printTextFormat pg_utf8format;
166+
extern printTextFormat pg_utf8format; /* ideally would be const, but... */
167167

168168

169169
extern void disable_sigpipe_trap(void);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy