public inbox for [email protected]
help / color / mirror / Atom feed[PATCH] hex squash commit
24+ messages / 2 participants
[nested] [flat]
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH] hex squash commit
@ 2021-01-01 20:04 Bruce Momjian <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Bruce Momjian @ 2021-01-01 20:04 UTC (permalink / raw)
---
src/backend/replication/backup_manifest.c | 2 +-
src/backend/utils/adt/encode.c | 34 +------------------
src/backend/utils/adt/varlena.c | 2 +-
src/common/Makefile | 2 +-
src/common/{hex_decode.c => hex.c} | 40 ++++++++++++++++++++---
src/include/common/hex.h (new) | 18 ++++++++++
src/include/common/hex_decode.h (gone) | 16 ---------
src/include/utils/builtins.h | 3 --
src/tools/msvc/Mkvcbuild.pm | 2 +-
9 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c
index c3f339c556..716f114d78 100644
--- a/src/backend/replication/backup_manifest.c
+++ b/src/backend/replication/backup_manifest.c
@@ -17,7 +17,7 @@
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
-#include "utils/builtins.h"
+#include "common/hex.h"
#include "utils/json.h"
static void AppendStringToManifest(backup_manifest_info *manifest, char *s);
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index a6c65b1657..bca941a496 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -15,7 +15,7 @@
#include <ctype.h>
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
@@ -141,38 +141,6 @@ binary_decode(PG_FUNCTION_ARGS)
}
-/*
- * HEX
- */
-
-static const char hextbl[] = "0123456789abcdef";
-
-uint64
-hex_encode(const char *src, size_t len, char *dst)
-{
- const char *end = src + len;
-
- while (src < end)
- {
- *dst++ = hextbl[(*src >> 4) & 0xF];
- *dst++ = hextbl[*src & 0xF];
- src++;
- }
- return (uint64) len * 2;
-}
-
-static uint64
-hex_enc_len(const char *src, size_t srclen)
-{
- return (uint64) srclen << 1;
-}
-
-static uint64
-hex_dec_len(const char *src, size_t srclen)
-{
- return (uint64) srclen >> 1;
-}
-
/*
* BASE64
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 9300d19e0c..79fcdcd178 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -22,7 +22,7 @@
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
-#include "common/hex_decode.h"
+#include "common/hex.h"
#include "common/unicode_norm.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
diff --git a/src/common/Makefile b/src/common/Makefile
index f624977939..93eb27a2aa 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -58,7 +58,7 @@ OBJS_COMMON = \
file_perm.o \
file_utils.o \
hashfn.o \
- hex_decode.o \
+ hex.o \
ip.o \
jsonapi.o \
keywords.o \
diff --git a/src/common/hex_decode.c b/src/common/hex.c
similarity index 79%
rename from src/common/hex_decode.c
rename to src/common/hex.c
index 3ecdc73b5c..97f57bcc32 100644
--- a/src/common/hex_decode.c
+++ b/src/common/hex.c
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
- * hex_decode.c
- * hex decoding
+ * hex.c
+ * hex processing
*
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * src/common/hex_decode.c
+ * src/common/hex.c
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#else
#include "mb/pg_wchar.h"
#endif
-#include "common/hex_decode.h"
+#include "common/hex.h"
static const int8 hexlookup[128] = {
@@ -40,6 +40,26 @@ static const int8 hexlookup[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
+/*
+ * HEX
+ */
+
+static const char hextbl[] = "0123456789abcdef";
+
+uint64
+hex_encode(const char *src, size_t len, char *dst)
+{
+ const char *end = src + len;
+
+ while (src < end)
+ {
+ *dst++ = hextbl[(*src >> 4) & 0xF];
+ *dst++ = hextbl[*src & 0xF];
+ src++;
+ }
+ return (uint64) len * 2;
+}
+
static inline char
get_hex(const char *cp)
{
@@ -104,3 +124,15 @@ hex_decode(const char *src, size_t len, char *dst)
return p - dst;
}
+
+uint64
+hex_enc_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen << 1;
+}
+
+uint64
+hex_dec_len(const char *src, size_t srclen)
+{
+ return (uint64) srclen >> 1;
+}
diff --git a/src/include/common/hex.h b/src/include/common/hex.h
new file mode 100644
index 0000000000..76154b65af
--- /dev/null
+++ b/src/include/common/hex.h
@@ -0,0 +1,18 @@
+/*
+ * hex.h
+ * hex processing
+ *
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/hex.h
+ */
+#ifndef COMMON_HEX_H
+#define COMMON_HEX_H
+
+extern uint64 hex_decode(const char *src, size_t len, char *dst);
+extern uint64 hex_encode(const char *src, size_t len, char *dst);
+extern uint64 hex_enc_len(const char *src, size_t srclen);
+extern uint64 hex_dec_len(const char *src, size_t srclen);
+
+#endif /* COMMON_HEX_H */
diff --git a/src/include/common/hex_decode.h b/src/include/common/hex_decode.h
deleted file mode 100644
index 1f99f069b2..0000000000
--- a/src/include/common/hex_decode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * hex_decode.h
- * hex decoding
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/common/hex_decode.h
- */
-#ifndef COMMON_HEX_DECODE_H
-#define COMMON_HEX_DECODE_H
-
-extern uint64 hex_decode(const char *src, size_t len, char *dst);
-
-
-#endif /* COMMON_HEX_DECODE_H */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 19271e0696..11ba6ae565 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -31,9 +31,6 @@ extern void domain_check(Datum value, bool isnull, Oid domainType,
extern int errdatatype(Oid datatypeOid);
extern int errdomainconstraint(Oid datatypeOid, const char *conname);
-/* encode.c */
-extern uint64 hex_encode(const char *src, size_t len, char *dst);
-
/* int.c */
extern int2vector *buildint2vector(const int16 *int2s, int n);
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 7f014a12c9..60b216cce0 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -121,7 +121,7 @@ sub mkvcbuild
our @pgcommonallfiles = qw(
archive.c base64.c checksum_helper.c
config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c hex_decode.c ip.c jsonapi.c
+ f2s.c file_perm.c file_utils.c hashfn.c hex.c ip.c jsonapi.c
keywords.c kwlookup.c link-canary.c md5_common.c
pg_get_line.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
--
2.20.1
--IJpNTDwzlM2Ie8A6--
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: RangeTblEntry.inh vs. RTE_SUBQUERY
@ 2024-03-03 10:02 Peter Eisentraut <[email protected]>
2024-03-07 15:56 ` Re: RangeTblEntry.inh vs. RTE_SUBQUERY Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Peter Eisentraut @ 2024-03-03 10:02 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Dean Rasheed <[email protected]>; pgsql-hackers
On 29.02.24 19:14, Tom Lane wrote:
> Peter Eisentraut <[email protected]> writes:
>> In nodes/parsenodes.h, it says both
>> This *must* be false for RTEs other than RTE_RELATION entries.
>
> Well, that's true in the parser ...
>
>> and also puts it under
>> Fields valid in all RTEs:
>> which are both wrong on opposite ends of the spectrum.
>> I think it would make more sense to group inh under "Fields valid for a
>> plain relation RTE" and then explain the exception for subqueries, like
>> it is done for several other fields.
>
> Dunno. The adjacent "lateral" field is also used for only selected
> RTE kinds.
The section is
/*
* Fields valid in all RTEs:
*/
Alias *alias; /* user-written alias clause, if any */
Alias *eref; /* expanded reference names */
bool lateral; /* subquery, function, or values is
LATERAL? */
bool inh; /* inheritance requested? */
bool inFromCl; /* present in FROM clause? */
List *securityQuals; /* security barrier quals to apply, if
any */
According to my testing, lateral is used for RTE_RELATION, RTE_SUBQUERY,
RTE_FUNCTION, RTE_TABLEFUNC, RTE_VALUES, which is 5 out of 9 possible.
So I think it might be okay to relabel that section (in actuality or
mentally) as "valid in several/many/most RTEs".
But I'm not sure what reason there would be for having inh there, which
is better described as "valid for RTE_RELATION, but also borrowed by
RTE_SUBQUERY", which is pretty much exactly what is the case for relid,
relkind, etc.
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: RangeTblEntry.inh vs. RTE_SUBQUERY
2024-03-03 10:02 Re: RangeTblEntry.inh vs. RTE_SUBQUERY Peter Eisentraut <[email protected]>
@ 2024-03-07 15:56 ` Peter Eisentraut <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Peter Eisentraut @ 2024-03-07 15:56 UTC (permalink / raw)
To: pgsql-hackers; +Cc: Dean Rasheed <[email protected]>; Tom Lane <[email protected]>
On 03.03.24 11:02, Peter Eisentraut wrote:
> On 29.02.24 19:14, Tom Lane wrote:
>> Peter Eisentraut <[email protected]> writes:
>>> In nodes/parsenodes.h, it says both
>>> This *must* be false for RTEs other than RTE_RELATION entries.
>>
>> Well, that's true in the parser ...
>>
>>> and also puts it under
>>> Fields valid in all RTEs:
>>> which are both wrong on opposite ends of the spectrum.
>>> I think it would make more sense to group inh under "Fields valid for a
>>> plain relation RTE" and then explain the exception for subqueries, like
>>> it is done for several other fields.
>>
>> Dunno. The adjacent "lateral" field is also used for only selected
>> RTE kinds.
>
> The section is
>
> /*
> * Fields valid in all RTEs:
> */
> Alias *alias; /* user-written alias clause, if any */
> Alias *eref; /* expanded reference names */
> bool lateral; /* subquery, function, or values is
> LATERAL? */
> bool inh; /* inheritance requested? */
> bool inFromCl; /* present in FROM clause? */
> List *securityQuals; /* security barrier quals to apply, if
> any */
>
> According to my testing, lateral is used for RTE_RELATION, RTE_SUBQUERY,
> RTE_FUNCTION, RTE_TABLEFUNC, RTE_VALUES, which is 5 out of 9 possible.
> So I think it might be okay to relabel that section (in actuality or
> mentally) as "valid in several/many/most RTEs".
>
> But I'm not sure what reason there would be for having inh there, which
> is better described as "valid for RTE_RELATION, but also borrowed by
> RTE_SUBQUERY", which is pretty much exactly what is the case for relid,
> relkind, etc.
I have committed the patches for this discussion.
Related discussion will continue at
https://www.postgresql.org/message-id/flat/[email protected]
/ https://commitfest.postgresql.org/47/4697/ .
^ permalink raw reply [nested|flat] 24+ messages in thread
end of thread, other threads:[~2024-03-07 15:56 UTC | newest]
Thread overview: 24+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2021-01-01 20:04 [PATCH] hex squash commit Bruce Momjian <[email protected]>
2024-03-03 10:02 Re: RangeTblEntry.inh vs. RTE_SUBQUERY Peter Eisentraut <[email protected]>
2024-03-07 15:56 ` Re: RangeTblEntry.inh vs. RTE_SUBQUERY Peter Eisentraut <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox