summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorTom Lane2012-02-29 00:53:39 +0000
committerTom Lane2012-02-29 00:53:39 +0000
commit5c02a00d440b90ead12658ce6ec9f4eee95dd0a3 (patch)
tree8211e45b554a6b4a3c35b2d919bdcc8cbd8c344c /src/port
parent0140a11b9ba5b22e1e4807e178bca770d46c3e28 (diff)
Move CRC tables to libpgport, and provide them in a separate include file.
This makes it much more convenient to build tools for Postgres that are separately compiled and require a matching CRC implementation. To prevent multiple copies of the CRC polynomial tables being introduced into the postgres binaries, they are now included in the static library libpgport that is mainly meant for replacement system functions. That seems like a bit of a kludge, but there's no better place. This cleans up building of the tools pg_controldata and pg_resetxlog, which previously had to build their own copies of pg_crc.o. In the future, external programs that need access to the CRC tables can include the tables directly from the new header file pg_crc_tables.h. Daniel Farina, reviewed by Abhijit Menon-Sen and Tom Lane
Diffstat (limited to 'src/port')
-rw-r--r--src/port/Makefile4
-rw-r--r--src/port/pg_crc.c21
2 files changed, 23 insertions, 2 deletions
diff --git a/src/port/Makefile b/src/port/Makefile
index 1bf0963ba78..4e3a8edd3a1 100644
--- a/src/port/Makefile
+++ b/src/port/Makefile
@@ -31,8 +31,8 @@ override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
LIBS += $(PTHREAD_LIBS)
OBJS = $(LIBOBJS) chklocale.o dirmod.o erand48.o exec.o fls.o inet_net_ntop.o \
- noblock.o path.o pgcheckdir.o pgmkdirp.o pgsleep.o pgstrcasecmp.o \
- qsort.o qsort_arg.o sprompt.o thread.o
+ noblock.o path.o pgcheckdir.o pg_crc.o pgmkdirp.o pgsleep.o \
+ pgstrcasecmp.o qsort.o qsort_arg.o sprompt.o thread.o
# foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
OBJS_SRV = $(OBJS:%.o=%_srv.o)
diff --git a/src/port/pg_crc.c b/src/port/pg_crc.c
new file mode 100644
index 00000000000..ebf4f3a61a7
--- /dev/null
+++ b/src/port/pg_crc.c
@@ -0,0 +1,21 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_crc.c
+ * PostgreSQL CRC support
+ *
+ * This file simply #includes the CRC table definitions so that they are
+ * available to programs linked with libpgport.
+ *
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ * src/port/pg_crc.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "c.h"
+
+#include "utils/pg_crc_tables.h"