重命名 inited 为 prepared

This commit is contained in:
Aoran Zeng committed 2026-08-19 14:08:35 +08:00
1 parent 822a11fea9
commit 648d5b3753
4 files changed
+8 -8

No files matched your search

+2 -2
View File
@@ -30,7 +30,7 @@ chef_debug_dish (Dish_t *dish)
printf (" Reset Function: %p\n", dish->resetfn);
printf (" Prepare Function: %p\n", dish->preparefn);
printf (" Inited?: %d\n", dish->inited);
printf (" Prepared?: %d\n", dish->prepared);
printf (" Sources: %p\n", dish->sources);
printf (" Sources Count: %d\n", dish->sources_n);
@@ -251,7 +251,7 @@ chef_set_rest_smURL_with_postfix (Dish_t *dish, char *postfix)
void
chef_use_other_dish_sources (Dish_t *this, Dish_t *other)
{
if (!other->inited)
if (!other->prepared)
{
if (other->preparefn)
other->preparefn();
+1 -1
View File
@@ -93,7 +93,7 @@ subdish_sibling_has_source_from_mirror (Dish_t *dish, const char *mirror_code)
if (sub_dish == current)
continue;
if (!sub_dish->inited)
if (!sub_dish->prepared)
sub_dish->preparefn ();
if (dish_has_source_from_mirror (sub_dish, mirror_code))
+1 -1
View File
@@ -626,7 +626,7 @@ chsrc_yield_source (Dish_t *dish, char *option)
*
* 目前可能出现这种情况的时候:组换源的时候,sub dishes 的 _setsrc() 被直接调用
*/
if (!dish->inited) dish->preparefn();
if (!dish->prepared) dish->preparefn();
Source_t source;
if (chsrc_in_dish_group_mode() && option)
+4 -4
View File
@@ -7,7 +7,7 @@
* Contributors : @livelycode36
* |
* Created On : <2023-08-29>
* Last Modified : <2026-08-14>
* Last Modified : <2026-08-19>
*
* chsrc struct
* ------------------------------------------------------------*/
@@ -186,7 +186,7 @@ typedef struct Dish_t
* 2. recipe 内部手动调用,如 "源dish"
*/
void (*preparefn) (void);
bool inited; /* 是否执行过了 preparefn() */
bool prepared; /* 是否执行过了 preparefn() */
XySeq_t *sub_dishes; /* 某些 dish 为 combo dish,完全由 sub dishes 定义 */
@@ -234,10 +234,10 @@ Dish_t;
#define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc;
#define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL;
#define chef_allow_NOOP(t)
#define chef_prep_this_dish(t,op) Dish_t *this = &t##_dish; this->inited = true; chef_allow_##op(t);
#define chef_prep_this_dish(t,op) Dish_t *this = &t##_dish; this->prepared = true; chef_allow_##op(t);
/* 简化 "源dish" 的编写 */
#define chef_prep_this_sources_dish(t) Dish_t *this = &t##_dish; this->inited = true; chef_allow_NOOP(t);
#define chef_prep_this_sources_dish(t) Dish_t *this = &t##_dish; this->prepared = true; chef_allow_NOOP(t);
/* 内部 "源dish" 的 preparefn 未通过 menu.c 的 add() 注册, 手动挂载 */
#define chef_set_preparefn_for_sources_dish(t) t##_dish.preparefn = t##_prepare;