git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: karthik nayak <karthik.188@gmail.com>,
	Justin Tobler <jltobler@gmail.com>
Subject: [PATCH v3 09/15] t/helper: inline `reftable_reader_print_file()`
Date: Thu, 22 Aug 2024 08:35:05 +0200	[thread overview]
Message-ID: <a62e4612e97dbe9c719ce1bf698158729bc14dd0.1724308389.git.ps@pks.im> (raw)
In-Reply-To: <cover.1724308389.git.ps@pks.im>

Move `reftable_reader_print_file()` into the "dump-reftable" helper.
This follows the same reasoning as the preceding commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 reftable/reader.c          | 21 ---------------------
 reftable/reftable-reader.h |  2 --
 t/helper/test-reftable.c   | 23 ++++++++++++++++++++++-
 3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/reftable/reader.c b/reftable/reader.c
index e3f58542297..fbd93b88dff 100644
--- a/reftable/reader.c
+++ b/reftable/reader.c
@@ -798,27 +798,6 @@ void reftable_table_from_reader(struct reftable_table *tab,
 	tab->table_arg = reader;
 }
 
-
-int reftable_reader_print_file(const char *tablename)
-{
-	struct reftable_block_source src = { NULL };
-	int err = reftable_block_source_from_file(&src, tablename);
-	struct reftable_reader *r = NULL;
-	struct reftable_table tab = { NULL };
-	if (err < 0)
-		goto done;
-
-	err = reftable_new_reader(&r, &src, tablename);
-	if (err < 0)
-		goto done;
-
-	reftable_table_from_reader(&tab, r);
-	err = reftable_table_print(&tab);
-done:
-	reftable_reader_free(r);
-	return err;
-}
-
 int reftable_reader_print_blocks(const char *tablename)
 {
 	struct {
diff --git a/reftable/reftable-reader.h b/reftable/reftable-reader.h
index a32f31d6486..7c7d1716516 100644
--- a/reftable/reftable-reader.h
+++ b/reftable/reftable-reader.h
@@ -64,8 +64,6 @@ uint64_t reftable_reader_min_update_index(struct reftable_reader *r);
 void reftable_table_from_reader(struct reftable_table *tab,
 				struct reftable_reader *reader);
 
-/* print table onto stdout for debugging. */
-int reftable_reader_print_file(const char *tablename);
 /* print blocks onto stdout for debugging. */
 int reftable_reader_print_blocks(const char *tablename);
 
diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c
index 7f37d0cd34b..19367c25f9a 100644
--- a/t/helper/test-reftable.c
+++ b/t/helper/test-reftable.c
@@ -1,5 +1,6 @@
 #include "reftable/system.h"
 #include "reftable/reftable-error.h"
+#include "reftable/reftable-generic.h"
 #include "reftable/reftable-reader.h"
 #include "reftable/reftable-stack.h"
 #include "reftable/reftable-tests.h"
@@ -28,6 +29,26 @@ static void print_help(void)
 	       "\n");
 }
 
+static int dump_reftable(const char *tablename)
+{
+	struct reftable_block_source src = { NULL };
+	int err = reftable_block_source_from_file(&src, tablename);
+	struct reftable_reader *r = NULL;
+	struct reftable_table tab = { NULL };
+	if (err < 0)
+		goto done;
+
+	err = reftable_new_reader(&r, &src, tablename);
+	if (err < 0)
+		goto done;
+
+	reftable_table_from_reader(&tab, r);
+	err = reftable_table_print(&tab);
+done:
+	reftable_reader_free(r);
+	return err;
+}
+
 int cmd__dump_reftable(int argc, const char **argv)
 {
 	int err = 0;
@@ -64,7 +85,7 @@ int cmd__dump_reftable(int argc, const char **argv)
 	if (opt_dump_blocks) {
 		err = reftable_reader_print_blocks(arg);
 	} else if (opt_dump_table) {
-		err = reftable_reader_print_file(arg);
+		err = dump_reftable(arg);
 	} else if (opt_dump_stack) {
 		err = reftable_stack_print_directory(arg, opt_hash_id);
 	}
-- 
2.46.0.164.g477ce5ccd6.dirty


  parent reply	other threads:[~2024-08-22  6:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 13:22 [PATCH v2 00/15] reftable: drop generic `reftable_table` interface Patrick Steinhardt
2024-08-14 13:22 ` [PATCH v2 01/15] reftable/merged: expose functions to initialize iterators Patrick Steinhardt
2024-08-14 13:22 ` [PATCH v2 02/15] reftable/merged: rename `reftable_new_merged_table()` Patrick Steinhardt
2024-08-14 13:22 ` [PATCH v2 03/15] reftable/merged: stop using generic tables in the merged table Patrick Steinhardt
2024-08-14 13:22 ` [PATCH v2 04/15] reftable/stack: open-code reading refs Patrick Steinhardt
2024-08-14 13:22 ` [PATCH v2 05/15] reftable/iter: drop double-checking logic Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 06/15] reftable/generic: move generic iterator code into iterator interface Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 07/15] reftable/dump: drop unused `compact_stack()` Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 08/15] t/helper: inline `reftable_dump_main()` Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 09/15] t/helper: inline `reftable_reader_print_file()` Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 10/15] t/helper: inline `reftable_stack_print_directory()` Patrick Steinhardt
2024-08-20  7:34   ` karthik nayak
2024-08-20  8:06     ` Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 11/15] t/helper: inline `reftable_table_print()` Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 12/15] t/helper: inline printing of reftable records Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 13/15] t/helper: use `hash_to_hex_algop()` to print hashes Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 14/15] t/helper: refactor to not use `struct reftable_table` Patrick Steinhardt
2024-08-14 13:23 ` [PATCH v2 15/15] reftable/generic: drop interface Patrick Steinhardt
2024-08-14 13:31 ` [PATCH v2 00/15] reftable: drop generic `reftable_table` interface Patrick Steinhardt
2024-08-14 17:21   ` Junio C Hamano
2024-08-15  5:29     ` Patrick Steinhardt
2024-08-20  7:38 ` karthik nayak
2024-08-22  6:34 ` [PATCH v3 " Patrick Steinhardt
2024-08-22  6:34   ` [PATCH v3 01/15] reftable/merged: expose functions to initialize iterators Patrick Steinhardt
2024-08-22  6:34   ` [PATCH v3 02/15] reftable/merged: rename `reftable_new_merged_table()` Patrick Steinhardt
2024-08-22  6:34   ` [PATCH v3 03/15] reftable/merged: stop using generic tables in the merged table Patrick Steinhardt
2024-08-22  6:34   ` [PATCH v3 04/15] reftable/stack: open-code reading refs Patrick Steinhardt
2024-08-22  6:34   ` [PATCH v3 05/15] reftable/iter: drop double-checking logic Patrick Steinhardt
2024-08-22  6:34   ` [PATCH v3 06/15] reftable/generic: move generic iterator code into iterator interface Patrick Steinhardt
2024-08-22  6:35   ` [PATCH v3 07/15] reftable/dump: drop unused `compact_stack()` Patrick Steinhardt
2024-08-22  6:35   ` [PATCH v3 08/15] t/helper: inline `reftable_dump_main()` Patrick Steinhardt
2024-08-22  6:35   ` Patrick Steinhardt [this message]
2024-08-22  6:35   ` [PATCH v3 10/15] t/helper: inline `reftable_stack_print_directory()` Patrick Steinhardt
2024-08-22  6:35   ` [PATCH v3 11/15] t/helper: inline `reftable_table_print()` Patrick Steinhardt
2024-08-22  6:35   ` [PATCH v3 12/15] t/helper: inline printing of reftable records Patrick Steinhardt
2024-08-22  6:35   ` [PATCH v3 13/15] t/helper: use `hash_to_hex_algop()` to print hashes Patrick Steinhardt
2024-08-22  6:35   ` [PATCH v3 14/15] t/helper: refactor to not use `struct reftable_table` Patrick Steinhardt
2024-08-22  6:35   ` [PATCH v3 15/15] reftable/generic: drop interface Patrick Steinhardt
2024-08-22  8:03   ` [PATCH v3 00/15] reftable: drop generic `reftable_table` interface karthik nayak
2024-08-22 17:11   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a62e4612e97dbe9c719ce1bf698158729bc14dd0.1724308389.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=jltobler@gmail.com \
    --cc=karthik.188@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).