[PATCH v5 04/29] trailer: move config_head and arg_head to if storage

Li Chen
2025-10-22T05:40:56Z

From: Li Chen <chenl311@chinatelecom.cn>

Move LIST_HEAD(config_head) and LIST_HEAD(arg_head) into the
non-only_input branch so they are created only when needed.
No functional change.

Signed-off-by: Li Chen <chenl311@chinatelecom.cn>
---
trailer.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/trailer.c b/trailer.c
index b7b0029e05..9abb5a522a 100644
--- a/trailer.c
+++ b/trailer.c
@@ -1265,14 +1265,15 @@ int trailer_process(const struct process_trailer_options *opts,
{
struct trailer_block *blk;
LIST_HEAD(orig_head);
- LIST_HEAD(config_head);
- LIST_HEAD(arg_head);
struct strbuf trailers_sb = STRBUF_INIT;
int had_trailer_before;

blk = parse_trailers(opts, msg, &orig_head);
had_trailer_before = !list_empty(&orig_head);
if (!opts->only_input) {
+ LIST_HEAD(config_head);
+ LIST_HEAD(arg_head);
+
parse_trailers_from_config(&config_head);
parse_trailers_from_command_line_args(&arg_head, new_trailer_head);
list_splice(&config_head, &arg_head);
--
2.51.0