From 788af6f8541d5f30acec540e4fd3cb24f5347209 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 1 Mar 2017 11:55:28 -0500 Subject: [PATCH] Move atooid() definition to a central place --- contrib/lo/lo.c | 2 -- contrib/vacuumlo/vacuumlo.c | 2 -- src/backend/bootstrap/bootparse.y | 2 -- src/backend/libpq/hba.c | 3 --- src/backend/nodes/readfuncs.c | 2 -- src/backend/utils/adt/misc.c | 2 -- src/bin/pg_basebackup/pg_basebackup.c | 2 -- src/bin/pg_upgrade/pg_upgrade.h | 2 -- src/bin/psql/common.h | 2 -- src/bin/scripts/droplang.c | 2 -- src/include/fe_utils/string_utils.h | 2 -- src/include/postgres_ext.h | 4 ++++ 12 files changed, 4 insertions(+), 23 deletions(-) diff --git a/contrib/lo/lo.c b/contrib/lo/lo.c index 050bd8a72a..6bd2430931 100644 --- a/contrib/lo/lo.c +++ b/contrib/lo/lo.c @@ -14,8 +14,6 @@ PG_MODULE_MAGIC; -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - /* * This is the trigger that protects us from orphaned large objects diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index d9dee2f7a0..06f469067b 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -24,8 +24,6 @@ #include "libpq-fe.h" #include "pg_getopt.h" -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - #define BUFSIZE 1024 enum trivalue diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 33d9f0b3c6..867f77076d 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -51,8 +51,6 @@ #include "tcop/dest.h" #include "utils/rel.h" -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - /* * Bison doesn't allocate anything that needs to live across parser calls, diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index be63a4bc63..323bfa858d 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -52,9 +52,6 @@ #endif -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) -#define atoxid(x) ((TransactionId) strtoul((x), NULL, 10)) - #define MAX_TOKEN 256 #define MAX_LINE 8192 diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index d2f69fe70b..05bf2e93e6 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -164,8 +164,6 @@ */ #define atoui(x) ((unsigned int) strtoul((x), NULL, 10)) -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - #define strtobool(x) ((*(x) == 't') ? true : false) #define nullable_string(token,length) \ diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index 0116fa08a6..8f7c1f81fd 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -44,8 +44,6 @@ #include "utils/builtins.h" #include "utils/timestamp.h" -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - /* * Common subroutine for num_nulls() and num_nonnulls(). diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 4b75e765bb..0a4944dd66 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -39,8 +39,6 @@ #include "streamutil.h" -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - typedef struct TablespaceListCell { struct TablespaceListCell *next; diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h index 968ab8a668..b78b877903 100644 --- a/src/bin/pg_upgrade/pg_upgrade.h +++ b/src/bin/pg_upgrade/pg_upgrade.h @@ -97,8 +97,6 @@ extern char *output_files[]; #define CLUSTER_NAME(cluster) ((cluster) == &old_cluster ? "old" : \ (cluster) == &new_cluster ? "new" : "none") -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - /* OID system catalog preservation added during PG 9.0 development */ #define TABLE_SPACE_SUBDIRS_CAT_VER 201001111 /* postmaster/postgres -b (binary_upgrade) flag added during PG 9.1 development */ diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h index dad0eb822a..a83bc69ab7 100644 --- a/src/bin/psql/common.h +++ b/src/bin/psql/common.h @@ -13,8 +13,6 @@ #include "libpq-fe.h" #include "fe_utils/print.h" -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - extern bool openQueryOutputFile(const char *fname, FILE **fout, bool *is_pipe); extern bool setQFout(const char *fname); diff --git a/src/bin/scripts/droplang.c b/src/bin/scripts/droplang.c index ab0215d495..97d1de43ae 100644 --- a/src/bin/scripts/droplang.c +++ b/src/bin/scripts/droplang.c @@ -14,8 +14,6 @@ #include "common.h" #include "fe_utils/print.h" -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - static void help(const char *progname); diff --git a/src/include/fe_utils/string_utils.h b/src/include/fe_utils/string_utils.h index 8f96a0b991..6fb7f5e30e 100644 --- a/src/include/fe_utils/string_utils.h +++ b/src/include/fe_utils/string_utils.h @@ -19,8 +19,6 @@ #include "libpq-fe.h" #include "pqexpbuffer.h" -#define atooid(x) ((Oid) strtoul((x), NULL, 10)) - /* Global variables controlling behavior of fmtId() and fmtQualifiedId() */ extern int quote_all_identifiers; extern PQExpBuffer (*getLocalPQExpBuffer) (void); diff --git a/src/include/postgres_ext.h b/src/include/postgres_ext.h index ae2f087798..452eae9935 100644 --- a/src/include/postgres_ext.h +++ b/src/include/postgres_ext.h @@ -39,6 +39,10 @@ typedef unsigned int Oid; #define OID_MAX UINT_MAX /* you will need to include to use the above #define */ +#define atooid(x) ((Oid) strtoul((x), NULL, 10)) +/* the above needs */ + + /* Define a signed 64-bit integer type for use in client API declarations. */ typedef PG_INT64_TYPE pg_int64; -- 2.40.0