From fac0a392b62254066300c051b077ef78a9d4cbcb Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Tue, 3 Oct 2023 13:32:45 -0400
Subject: [PATCH v6 2/4] Move src/bin/pg_verifybackup/parse_manifest.c into
 src/common.

This makes it possible for the code to be easily reused by other
client-side tools, and/or by the server.
---
 src/bin/pg_verifybackup/Makefile                             | 1 -
 src/bin/pg_verifybackup/meson.build                          | 1 -
 src/bin/pg_verifybackup/pg_verifybackup.c                    | 2 +-
 src/common/Makefile                                          | 1 +
 src/common/meson.build                                       | 1 +
 src/{bin/pg_verifybackup => common}/parse_manifest.c         | 4 ++--
 src/{bin/pg_verifybackup => include/common}/parse_manifest.h | 2 +-
 7 files changed, 6 insertions(+), 6 deletions(-)
 rename src/{bin/pg_verifybackup => common}/parse_manifest.c (99%)
 rename src/{bin/pg_verifybackup => include/common}/parse_manifest.h (97%)

diff --git a/src/bin/pg_verifybackup/Makefile b/src/bin/pg_verifybackup/Makefile
index 596df15118..8f04fa662c 100644
--- a/src/bin/pg_verifybackup/Makefile
+++ b/src/bin/pg_verifybackup/Makefile
@@ -21,7 +21,6 @@ LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
 
 OBJS = \
 	$(WIN32RES) \
-	parse_manifest.o \
 	pg_verifybackup.o
 
 all: pg_verifybackup
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
index 9369da1bc6..58f780d1a6 100644
--- a/src/bin/pg_verifybackup/meson.build
+++ b/src/bin/pg_verifybackup/meson.build
@@ -1,7 +1,6 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 pg_verifybackup_sources = files(
-  'parse_manifest.c',
   'pg_verifybackup.c'
 )
 
diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c
index 059836f0e6..ce423a03d4 100644
--- a/src/bin/pg_verifybackup/pg_verifybackup.c
+++ b/src/bin/pg_verifybackup/pg_verifybackup.c
@@ -20,9 +20,9 @@
 
 #include "common/hashfn.h"
 #include "common/logging.h"
+#include "common/parse_manifest.h"
 #include "fe_utils/simple_list.h"
 #include "getopt_long.h"
-#include "parse_manifest.h"
 #include "pgtime.h"
 
 /*
diff --git a/src/common/Makefile b/src/common/Makefile
index 70884be00c..3c8effc533 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -66,6 +66,7 @@ OBJS_COMMON = \
 	kwlookup.o \
 	link-canary.o \
 	md5_common.o \
+	parse_manifest.o \
 	percentrepl.o \
 	pg_get_line.o \
 	pg_lzcompress.o \
diff --git a/src/common/meson.build b/src/common/meson.build
index ae05ac63cf..aa646f96a3 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -18,6 +18,7 @@ common_sources = files(
   'kwlookup.c',
   'link-canary.c',
   'md5_common.c',
+  'parse_manifest.c',
   'percentrepl.c',
   'pg_get_line.c',
   'pg_lzcompress.c',
diff --git a/src/bin/pg_verifybackup/parse_manifest.c b/src/common/parse_manifest.c
similarity index 99%
rename from src/bin/pg_verifybackup/parse_manifest.c
rename to src/common/parse_manifest.c
index f0acd9f1e7..9895f2f17d 100644
--- a/src/bin/pg_verifybackup/parse_manifest.c
+++ b/src/common/parse_manifest.c
@@ -6,15 +6,15 @@
  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * src/bin/pg_verifybackup/parse_manifest.c
+ * src/common/parse_manifest.c
  *
  *-------------------------------------------------------------------------
  */
 
 #include "postgres_fe.h"
 
-#include "parse_manifest.h"
 #include "common/jsonapi.h"
+#include "common/parse_manifest.h"
 
 /*
  * Semantic states for JSON manifest parsing.
diff --git a/src/bin/pg_verifybackup/parse_manifest.h b/src/include/common/parse_manifest.h
similarity index 97%
rename from src/bin/pg_verifybackup/parse_manifest.h
rename to src/include/common/parse_manifest.h
index 7387a917a2..7b24c5d785 100644
--- a/src/bin/pg_verifybackup/parse_manifest.h
+++ b/src/include/common/parse_manifest.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * src/bin/pg_verifybackup/parse_manifest.h
+ * src/include/common/parse_manifest.h
  *
  *-------------------------------------------------------------------------
  */
-- 
2.37.1 (Apple Git-137.1)

