Content-Length: 582966 | pFad | http://github.com/postgrespro/postgres_cluster/commit/e6afa8918c461c1dd80c5063a950518fa4e950cd

E6 Move wchar.c and encnames.c to src/common/. · postgrespro/postgres_cluster@e6afa89 · GitHub
Skip to content

Commit e6afa89

Browse files
committed
Move wchar.c and encnames.c to src/common/.
Formerly, various frontend directories symlinked these two sources and then built them locally. That's an ancient, ugly hack, and we now have a much better way: put them into libpgcommon. So do that. (The immediate motivation for this is the prospect of having to introduce still more symlinking if we don't.) This commit moves these two files absolutely verbatim, for ease of reviewing the git history. There's some follow-on work to be done that will modify them a bit. Robert Haas, Tom Lane Discussion: https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com
1 parent 2eb34ac commit e6afa89

File tree

12 files changed

+23
-51
lines changed

12 files changed

+23
-51
lines changed

src/backend/utils/mb/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ include $(top_builddir)/src/Makefile.global
1414

1515
OBJS = \
1616
conv.o \
17-
encnames.o \
1817
mbutils.o \
1918
stringinfo_mb.o \
20-
wchar.o \
2119
wstrcmp.o \
2220
wstrncmp.o
2321

src/backend/utils/mb/README

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@ src/backend/utils/mb/README
33
Encodings
44
=========
55

6-
encnames.c: public functions for both the backend and the frontend.
76
conv.c: static functions and a public table for code conversion
8-
wchar.c: mostly static functions and a public table for mb string and
9-
multibyte conversion
107
mbutils.c: public functions for the backend only.
11-
requires conv.c and wchar.c
128
stringinfo_mb.c: public backend-only multibyte-aware stringinfo functions
139
wstrcmp.c: strcmp for mb
1410
wstrncmp.c: strncmp for mb
1511
win866.c: a tool to generate KOI8 <--> CP866 conversion table
1612
iso.c: a tool to generate KOI8 <--> ISO8859-5 conversion table
1713
win1251.c: a tool to generate KOI8 <--> CP1251 conversion table
1814

15+
See also in src/common/:
16+
17+
encnames.c: public functions for encoding names
18+
wchar.c: mostly static functions and a public table for mb string and
19+
multibyte conversion
20+
1921
Introduction
2022
------------
2123
http://www.cprogramming.com/tutorial/unicode.html

src/bin/initdb/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/encnames.c
21
/localtime.c
32

43
/initdb

src/bin/initdb/Makefile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ include $(top_builddir)/src/Makefile.global
1818

1919
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone $(CPPFLAGS)
2020

21-
# note: we need libpq only because fe_utils does
21+
# Note: it's important that we link to encnames.o from libpgcommon, not
22+
# from libpq, else we have risks of version skew if we run with a libpq
23+
# shared library from a different PG version. The libpq_pgport macro
24+
# should ensure that that happens.
25+
#
26+
# We need libpq only because fe_utils does.
2227
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
2328

2429
# use system timezone data?
@@ -28,7 +33,6 @@ endif
2833

2934
OBJS = \
3035
$(WIN32RES) \
31-
encnames.o \
3236
findtimezone.o \
3337
initdb.o \
3438
localtime.o
@@ -38,15 +42,7 @@ all: initdb
3842
initdb: $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils
3943
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
4044

41-
# We used to pull in all of libpq to get encnames.c, but that
42-
# exposes us to risks of version skew if we link to a shared library.
43-
# Do it the hard way, instead, so that we're statically linked.
44-
45-
encnames.c: % : $(top_srcdir)/src/backend/utils/mb/%
46-
rm -f $@ && $(LN_S) $< .
47-
48-
# Likewise, pull in localtime.c from src/timezones
49-
45+
# We must pull in localtime.c from src/timezones
5046
localtime.c: % : $(top_srcdir)/src/timezone/%
5147
rm -f $@ && $(LN_S) $< .
5248

@@ -60,7 +56,7 @@ uninstall:
6056
rm -f '$(DESTDIR)$(bindir)/initdb$(X)'
6157

6258
clean distclean maintainer-clean:
63-
rm -f initdb$(X) $(OBJS) encnames.c localtime.c
59+
rm -f initdb$(X) $(OBJS) localtime.c
6460
rm -rf tmp_check
6561

6662
# ensure that changes in datadir propagate into object file

src/common/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ OBJS_COMMON = \
5151
config_info.o \
5252
controldata_utils.o \
5353
d2s.o \
54+
encnames.o \
5455
exec.o \
5556
f2s.o \
5657
file_perm.o \
@@ -70,7 +71,8 @@ OBJS_COMMON = \
7071
stringinfo.o \
7172
unicode_norm.o \
7273
username.o \
73-
wait_error.o
74+
wait_error.o \
75+
wchar.o
7476

7577
ifeq ($(with_openssl),yes)
7678
OBJS_COMMON += sha2_openssl.o
File renamed without changes.

src/common/saslprep.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@
2727

2828
#include "common/saslprep.h"
2929
#include "common/unicode_norm.h"
30-
31-
/*
32-
* Note: The functions in this file depend on functions from
33-
* src/backend/utils/mb/wchar.c, so in order to use this in frontend
34-
* code, you will need to link that in, too.
35-
*/
3630
#include "mb/pg_wchar.h"
3731

3832
/*
File renamed without changes.

src/include/mb/pg_wchar.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ typedef unsigned int pg_wchar;
222222
* PostgreSQL encoding identifiers
223223
*
224224
* WARNING: the order of this enum must be same as order of entries
225-
* in the pg_enc2name_tbl[] array (in mb/encnames.c), and
226-
* in the pg_wchar_table[] array (in mb/wchar.c)!
225+
* in the pg_enc2name_tbl[] array (in src/common/encnames.c), and
226+
* in the pg_wchar_table[] array (in src/common/wchar.c)!
227227
*
228228
* If you add some encoding don't forget to check
229229
* PG_ENCODING_BE_LAST macro.

src/interfaces/libpq/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
11
/exports.list
2-
# .c files that are symlinked in from elsewhere
3-
/encnames.c
4-
/wchar.c

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/e6afa8918c461c1dd80c5063a950518fa4e950cd

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy