Commit 05d8449e authored by Robert Haas's avatar Robert Haas

Move src/backend/utils/hash/hashfn.c to src/common

This also involves renaming src/include/utils/hashutils.h, which
becomes src/include/common/hashfn.h. Perhaps an argument can be
made for keeping the hashutils.h name, but it seemed more
consistent to make it match the name of the file, and also more
descriptive of what is actually going on here.

Patch by me, reviewed by Suraj Kharage and Mark Dilger. Off-list
advice on how not to break the Windows build from Davinder Singh
and Amit Kapila.

Discussion: http://postgr.es/m/CA+TgmoaRiG4TXND8QuM6JXFRkM_1wL2ZNhzaUKsuec9-4yrkgw@mail.gmail.com
parent 008cf040
......@@ -4,9 +4,9 @@
#include "postgres.h"
#include "catalog/pg_collation.h"
#include "common/hashfn.h"
#include "utils/builtins.h"
#include "utils/formatting.h"
#include "utils/hashutils.h"
#include "utils/varlena.h"
PG_MODULE_MAGIC;
......
......@@ -5,10 +5,10 @@
#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "funcapi.h"
#include "hstore.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/memutils.h"
/* old names for C functions */
......
......@@ -62,6 +62,7 @@
#include <unistd.h>
#include "catalog/pg_authid.h"
#include "common/hashfn.h"
#include "executor/instrument.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
......@@ -77,7 +78,6 @@
#include "tcop/utility.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/memutils.h"
PG_MODULE_MAGIC;
......
......@@ -14,10 +14,10 @@
#include "catalog/pg_proc.h"
#include "commands/seclabel.h"
#include "common/hashfn.h"
#include "sepgsql.h"
#include "storage/ipc.h"
#include "utils/guc.h"
#include "utils/hashutils.h"
#include "utils/memutils.h"
/*
......
......@@ -23,12 +23,12 @@
#include "access/tupdesc_details.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "miscadmin.h"
#include "parser/parse_type.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/hashutils.h"
#include "utils/resowner_private.h"
#include "utils/syscache.h"
......
......@@ -28,8 +28,8 @@
#include "access/hash.h"
#include "catalog/pg_collation.h"
#include "common/hashfn.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/pg_locale.h"
/*
......
......@@ -28,9 +28,9 @@
#include "access/tsmapi.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "optimizer/optimizer.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
/* Private state */
......
......@@ -29,9 +29,9 @@
#include "access/relscan.h"
#include "access/tsmapi.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "optimizer/optimizer.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
/* Private state */
......
......@@ -126,6 +126,7 @@
#include "access/xact.h"
#include "catalog/pg_database.h"
#include "commands/async.h"
#include "common/hashfn.h"
#include "funcapi.h"
#include "libpq/libpq.h"
#include "libpq/pqformat.h"
......@@ -138,7 +139,6 @@
#include "storage/sinval.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
#include "utils/snapmgr.h"
......
......@@ -19,9 +19,9 @@
#include "postgres.h"
#include "access/parallel.h"
#include "common/hashfn.h"
#include "executor/executor.h"
#include "miscadmin.h"
#include "utils/hashutils.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
......
......@@ -35,9 +35,9 @@
#include <math.h>
#include "common/hashfn.h"
#include "lib/bloomfilter.h"
#include "port/pg_bitutils.h"
#include "utils/hashutils.h"
#define MAX_HASH_FUNCS 10
......
......@@ -31,11 +31,11 @@
#include "postgres.h"
#include "common/hashfn.h"
#include "lib/dshash.h"
#include "storage/ipc.h"
#include "storage/lwlock.h"
#include "utils/dsa.h"
#include "utils/hashutils.h"
#include "utils/memutils.h"
/*
......
......@@ -20,10 +20,10 @@
*/
#include "postgres.h"
#include "common/hashfn.h"
#include "nodes/bitmapset.h"
#include "nodes/pg_list.h"
#include "port/pg_bitutils.h"
#include "utils/hashutils.h"
#define WORDNUM(x) ((x) / BITS_PER_BITMAPWORD)
......
......@@ -41,11 +41,11 @@
#include <limits.h>
#include "access/htup_details.h"
#include "common/hashfn.h"
#include "nodes/bitmapset.h"
#include "nodes/tidbitmap.h"
#include "storage/lwlock.h"
#include "utils/dsa.h"
#include "utils/hashutils.h"
/*
* The maximum number of tuples per page is not large (typically 256 with
......
......@@ -21,6 +21,7 @@
#include "catalog/pg_inherits.h"
#include "catalog/pg_type.h"
#include "commands/tablecmds.h"
#include "common/hashfn.h"
#include "executor/executor.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
......@@ -32,7 +33,6 @@
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/fmgroids.h"
#include "utils/hashutils.h"
#include "utils/lsyscache.h"
#include "utils/partcache.h"
#include "utils/ruleutils.h"
......
......@@ -22,11 +22,11 @@
#include "catalog/pg_tablespace.h"
#include "commands/tablespace.h"
#include "common/hashfn.h"
#include "miscadmin.h"
#include "storage/dsm.h"
#include "storage/sharedfileset.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
static void SharedFileSetOnDetach(dsm_segment *segment, Datum datum);
static void SharedFileSetPath(char *path, SharedFileSet *fileset, Oid tablespace);
......
......@@ -16,9 +16,9 @@
#include "catalog/pg_collation.h"
#include "catalog/pg_operator.h"
#include "commands/vacuum.h"
#include "common/hashfn.h"
#include "tsearch/ts_type.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
/* A hash key for lexemes */
......
......@@ -26,6 +26,7 @@
#include "commands/dbcommands.h"
#include "commands/proclang.h"
#include "commands/tablespace.h"
#include "common/hashfn.h"
#include "foreign/foreign.h"
#include "funcapi.h"
#include "lib/qunique.h"
......@@ -34,7 +35,6 @@
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/catcache.h"
#include "utils/hashutils.h"
#include "utils/inval.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
......
......@@ -21,6 +21,7 @@
#include <time.h>
#include "access/xact.h"
#include "common/hashfn.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "nodes/supportnodes.h"
......@@ -29,7 +30,6 @@
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/datetime.h"
#include "utils/hashutils.h"
#include "utils/sortsupport.h"
/*
......
......@@ -63,9 +63,9 @@
#include "access/stratnum.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/jsonb.h"
#include "utils/jsonpath.h"
#include "utils/varlena.h"
......
......@@ -15,11 +15,11 @@
#include "catalog/pg_collation.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/jsonapi.h"
#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/datetime.h"
#include "utils/hashutils.h"
#include "utils/json.h"
#include "utils/jsonb.h"
#include "utils/memutils.h"
......
......@@ -13,12 +13,12 @@
#include "postgres.h"
#include "common/hashfn.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
#include "port/pg_bswap.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/hashutils.h"
#include "utils/inet.h"
#include "utils/sortsupport.h"
......
......@@ -21,9 +21,9 @@
#include "postgres.h"
#include "common/hashfn.h"
#include "libpq/pqformat.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/inet.h"
/*
......
......@@ -15,6 +15,7 @@
#include "access/stratnum.h"
#include "catalog/pg_opfamily.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/ip.h"
#include "lib/hyperloglog.h"
#include "libpq/libpq-be.h"
......@@ -26,7 +27,6 @@
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/guc.h"
#include "utils/hashutils.h"
#include "utils/inet.h"
#include "utils/lsyscache.h"
#include "utils/sortsupport.h"
......
......@@ -27,6 +27,7 @@
#include <math.h>
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
#include "funcapi.h"
#include "lib/hyperloglog.h"
......@@ -38,7 +39,6 @@
#include "utils/builtins.h"
#include "utils/float.h"
#include "utils/guc.h"
#include "utils/hashutils.h"
#include "utils/int8.h"
#include "utils/numeric.h"
#include "utils/sortsupport.h"
......
......@@ -31,12 +31,12 @@
#include "postgres.h"
#include "access/tupmacs.h"
#include "common/hashfn.h"
#include "lib/stringinfo.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/hashutils.h"
#include "utils/int8.h"
#include "utils/lsyscache.h"
#include "utils/rangetypes.h"
......
......@@ -25,12 +25,12 @@
#include "access/tableam.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "parser/parsetree.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
#include "utils/varlena.h"
......
......@@ -13,12 +13,12 @@
#include "postgres.h"
#include "common/hashfn.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
#include "port/pg_bswap.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/hashutils.h"
#include "utils/sortsupport.h"
#include "utils/uuid.h"
......
......@@ -17,13 +17,13 @@
#include "access/detoast.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "nodes/nodeFuncs.h"
#include "nodes/supportnodes.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/hashutils.h"
#include "utils/lsyscache.h"
#include "utils/pg_locale.h"
#include "utils/varlena.h"
......
......@@ -20,6 +20,7 @@
#include "access/detoast.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
......@@ -29,7 +30,6 @@
#include "regex/regex.h"
#include "utils/builtins.h"
#include "utils/bytea.h"
#include "utils/hashutils.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/pg_locale.h"
......
......@@ -24,6 +24,7 @@
#include "catalog/pg_collation.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "miscadmin.h"
#ifdef CATCACHE_STATS
#include "storage/ipc.h" /* for on_proc_exit */
......@@ -32,7 +33,6 @@
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/fmgroids.h"
#include "utils/hashutils.h"
#include "utils/inval.h"
#include "utils/memutils.h"
#include "utils/rel.h"
......
......@@ -14,7 +14,6 @@ include $(top_builddir)/src/Makefile.global
OBJS = \
dynahash.o \
hashfn.o \
pg_crc.o
include $(top_srcdir)/src/backend/common.mk
......@@ -86,10 +86,10 @@
#include <limits.h>
#include "access/xact.h"
#include "common/hashfn.h"
#include "storage/shmem.h"
#include "storage/spin.h"
#include "utils/dynahash.h"
#include "utils/hashutils.h"
#include "utils/memutils.h"
......
......@@ -20,12 +20,12 @@
*/
#include "postgres.h"
#include "common/hashfn.h"
#include "jit/jit.h"
#include "storage/bufmgr.h"
#include "storage/ipc.h"
#include "storage/predicate.h"
#include "storage/proc.h"
#include "utils/hashutils.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/resowner_private.h"
......
......@@ -54,6 +54,7 @@ OBJS_COMMON = \
exec.o \
f2s.o \
file_perm.o \
hashfn.o \
ip.o \
jsonapi.o \
keywords.o \
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* src/backend/utils/hash/hashfn.c
* src/common/hashfn.c
*
* NOTES
* It is expected that every bit of a hash function's 32-bit result is
......@@ -23,7 +23,7 @@
*/
#include "postgres.h"
#include "utils/hashutils.h"
#include "common/hashfn.h"
/*
......
......@@ -21,10 +21,10 @@
#include "access/itup.h"
#include "access/sdir.h"
#include "catalog/pg_am_d.h"
#include "common/hashfn.h"
#include "lib/stringinfo.h"
#include "storage/bufmgr.h"
#include "storage/lockdefs.h"
#include "utils/hashutils.h"
#include "utils/hsearch.h"
#include "utils/relcache.h"
......
......@@ -4,8 +4,8 @@
* Portions Copyright (c) 2017-2020, PostgreSQL Global Development Group
*/
#ifndef HASHUTILS_H
#define HASHUTILS_H
#ifndef HASHFN_H
#define HASHFN_H
/*
......@@ -101,4 +101,4 @@ murmurhash32(uint32 data)
return h;
}
#endif /* HASHUTILS_H */
#endif /* HASHFN_H */
......@@ -120,7 +120,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
base64.c config_info.c controldata_utils.c d2s.c encnames.c exec.c
f2s.c file_perm.c ip.c jsonapi.c
f2s.c file_perm.c hashfn.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5.c
pg_lzcompress.c pgfnames.c psprintf.c relpath.c rmtree.c
saslprep.c scram-common.c string.c stringinfo.c unicode_norm.c username.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment