From 46083f03ec5b6cc471b20485ee61b0c0be485d40 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 18:28:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`chef=5Fdebug=5Fcontributo?= =?UTF-8?q?r()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 4 ++-- src/framework/chef.c | 25 +++++++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index bee138b..fd5724b 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -529,6 +529,8 @@ typedef enum { bool get_target (const char *input, TargetOp code, char *option) { + chsrc_register_contributors (); + Target_t *target = NULL; bool matched = iterate_menu (chsrc_pl_menu, input, &target); @@ -537,8 +539,6 @@ get_target (const char *input, TargetOp code, char *option) if (!matched) return false; - chsrc_register_contributors (); - if (TargetOp_Set_Source==code) { if (target->setfn) diff --git a/src/framework/chef.c b/src/framework/chef.c index 0c2c0b8..4e10ad3 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -305,19 +305,17 @@ chef_debug_target (Target_t *target) #ifdef XY_DEBUG if (!target) { - chsrc_debug2 ("t", "Target is NULL"); + chsrc_debug2 ("target", "Target is NULL"); return; } - say ("Debug Target Information:"); + say ("DEBUG Target Information:"); printf (" Get Function: %p\n", target->getfn); printf (" Set Function: %p\n", target->setfn); printf (" Reset Function: %p\n", target->resetfn); printf (" Sources: %p\n", target->sources); printf (" Sources Count: %lld\n", target->sources_n); - printf (" Authors: %p\n", target->authors); - printf (" Authors Count: %lld\n", target->authors_n); printf (" Chef: %p\n", target->chef); printf (" Cooks: %p\n", target->cooks); printf (" Cooks Count: %lld\n", target->cooks_n); @@ -325,3 +323,22 @@ chef_debug_target (Target_t *target) printf (" Contributors Count: %lld\n", target->contributors_n); #endif } + + +void +chef_debug_contributor (Contributor_t *contributor) +{ +#ifdef XY_DEBUG + if (!contributor) + { + chsrc_debug2 ("contrib", "Contributor is NULL"); + return; + } + + say ("DEBUG Contributor Information:"); + printf (" ID: %s\n", contributor->id); + printf (" Name: %s\n", contributor->name); + printf (" Email: %s\n", contributor->email); + printf (" DisplayName: %s\n", contributor->display_name); +#endif +}