diff mbox series

[6/6] json-writer.[ch]: remove unused formatting functions

Message ID patch-6.6-e14ee1f8c47-20211119T124420Z-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series various: remove dead code | expand

Commit Message

Ævar Arnfjörð Bjarmason Nov. 19, 2021, 12:46 p.m. UTC
These were added in 75459410edd (json_writer: new routines to create
JSON data, 2018-07-13) for future use with trace2, but have not been
used by anything. These are easy enough to bring back should we need
them, but until then there's no point in carrying them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 json-writer.c | 24 ------------------------
 json-writer.h |  3 ---
 2 files changed, 27 deletions(-)

Comments

Jeff King Nov. 19, 2021, 2:41 p.m. UTC | #1
On Fri, Nov 19, 2021 at 01:46:26PM +0100, Ævar Arnfjörð Bjarmason wrote:

> These were added in 75459410edd (json_writer: new routines to create
> JSON data, 2018-07-13) for future use with trace2, but have not been
> used by anything. These are easy enough to bring back should we need
> them, but until then there's no point in carrying them.

This is another one where I could _imagine_ somebody using these in a
custom patch or topic in flight (though I don't have any such case
myself). And they complete the json-writer API, so keeping them is not
that ugly.

But I'm also OK with dropping them under the notion of cleanliness, and
that they're easy-ish to resurrect.

-Peff
Junio C Hamano Nov. 19, 2021, 9:53 p.m. UTC | #2
Jeff King <peff@peff.net> writes:

> On Fri, Nov 19, 2021 at 01:46:26PM +0100, Ævar Arnfjörð Bjarmason wrote:
>
>> These were added in 75459410edd (json_writer: new routines to create
>> JSON data, 2018-07-13) for future use with trace2, but have not been
>> used by anything. These are easy enough to bring back should we need
>> them, but until then there's no point in carrying them.
>
> This is another one where I could _imagine_ somebody using these in a
> custom patch or topic in flight (though I don't have any such case
> myself). And they complete the json-writer API, so keeping them is not
> that ugly.

This falls into the same category as 5/6 in my mind.

> But I'm also OK with dropping them under the notion of cleanliness, and
> that they're easy-ish to resurrect.

Again, all the same "resurrecting is the easy part, knowing we used
to have one is hardre", "keeping is not without cost", "apparently
incomplete API is an invitation for future reinvention" apply here.
diff mbox series

Patch

diff --git a/json-writer.c b/json-writer.c
index f1cfd8fa8c6..8a81c2d5fce 100644
--- a/json-writer.c
+++ b/json-writer.c
@@ -331,36 +331,12 @@  void jw_array_false(struct json_writer *jw)
 	strbuf_addstr(&jw->json, "false");
 }
 
-void jw_array_bool(struct json_writer *jw, int value)
-{
-	if (value)
-		jw_array_true(jw);
-	else
-		jw_array_false(jw);
-}
-
 void jw_array_null(struct json_writer *jw)
 {
 	array_common(jw);
 	strbuf_addstr(&jw->json, "null");
 }
 
-void jw_array_sub_jw(struct json_writer *jw, const struct json_writer *value)
-{
-	assert_is_terminated(value);
-
-	array_common(jw);
-	append_sub_jw(jw, value);
-}
-
-void jw_array_argc_argv(struct json_writer *jw, int argc, const char **argv)
-{
-	int k;
-
-	for (k = 0; k < argc; k++)
-		jw_array_string(jw, argv[k]);
-}
-
 void jw_array_argv(struct json_writer *jw, const char **argv)
 {
 	while (*argv)
diff --git a/json-writer.h b/json-writer.h
index 209355e0f12..563c7e0e004 100644
--- a/json-writer.h
+++ b/json-writer.h
@@ -95,10 +95,7 @@  void jw_array_intmax(struct json_writer *jw, intmax_t value);
 void jw_array_double(struct json_writer *jw, int precision, double value);
 void jw_array_true(struct json_writer *jw);
 void jw_array_false(struct json_writer *jw);
-void jw_array_bool(struct json_writer *jw, int value);
 void jw_array_null(struct json_writer *jw);
-void jw_array_sub_jw(struct json_writer *jw, const struct json_writer *value);
-void jw_array_argc_argv(struct json_writer *jw, int argc, const char **argv);
 void jw_array_argv(struct json_writer *jw, const char **argv);
 
 void jw_array_inline_begin_object(struct json_writer *jw);