使用 chef_use_this()

This commit is contained in:
Aoran Zeng
2026-01-21 15:30:53 +08:00
parent df1c4fae11
commit 7702906d7e
4 changed files with 14 additions and 14 deletions

View File

@@ -2,12 +2,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Name : mirror.c * File Name : mirror.c
* File Authors : 曾奥然 <ccmywish@qq.com> * File Authors : @ccmywish
* | 郭恒 <2085471348@qq.com> * | @G_I_Y
* Contributors : Shengwei Chen <414685209@qq.com> * Contributors : @livelycode36
* | Jialin Lyu <jialinlvcn@aliyun.com> * | @jialinlvcn
* | Mikachu2333 <mikachu.23333@zohomail.com> * | @Mikachu2333
* | BingChunMoLi <bingchunmoli@bingchunmoli.com> * | @BingChunMoLi
* | * |
* Created On : <2023-08-29> * Created On : <2023-08-29>
* Last Modified : <2025-10-07> * Last Modified : <2025-10-07>

View File

@@ -1,13 +1,13 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Name : struct.h * File Name : struct.h
* File Authors : 曾奥然 <ccmywish@qq.com> * File Authors : @ccmywish
* | 郭恒 <2085471348@qq.com> * | @G_I_Y
* Contributors : Shengwei Chen <414685209@qq.com> * Contributors : @livelycode36
* | * |
* Created On : <2023-08-29> * Created On : <2023-08-29>
* Last Modified : <2025-08-22> * Last Modified : <2026-01-21>
* *
* chsrc struct * chsrc struct
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
@@ -168,7 +168,7 @@ Target_t;
#define chef_allow_NOOP(t) #define chef_allow_NOOP(t)
#define chef_prep_this(t,op) Target_t *this = &t##_target; this->inited = true; chef_allow_##op(t); #define chef_prep_this(t,op) Target_t *this = &t##_target; this->inited = true; chef_allow_##op(t);
#define use_this(t) Target_t *this = &t##_target; #define chef_use_this(t) Target_t *this = &t##_target;
#define chsrc_use_this_source(t) Target_t *this = &t##_target; Source_t source = chsrc_yield_source_and_confirm (this, option); #define chsrc_use_this_source(t) Target_t *this = &t##_target; Source_t source = chsrc_yield_source_and_confirm (this, option);
#define def_sources_begin() Source_t sources[] = { #define def_sources_begin() Source_t sources[] = {

View File

@@ -148,7 +148,7 @@ os_ubuntu_setsrc (char *option)
void void
os_ubuntu_resetsrc (char *option) os_ubuntu_resetsrc (char *option)
{ {
use_this (os_ubuntu); chef_use_this (os_ubuntu);
char *arch = chsrc_get_cpuarch (); char *arch = chsrc_get_cpuarch ();
if (strncmp (arch, "x86_64", 6)!=0) if (strncmp (arch, "x86_64", 6)!=0)
{ {

View File

@@ -46,7 +46,7 @@ os_freebsd_setsrc (char *option)
// 据 @yklaFreeBSD不自带sudo但是我们依然要保证是root权限 // 据 @yklaFreeBSD不自带sudo但是我们依然要保证是root权限
chsrc_ensure_root (); chsrc_ensure_root ();
use_this (os_freebsd); chef_use_this (os_freebsd);
int index = use_specific_mirror_or_auto_select (option, this); int index = use_specific_mirror_or_auto_select (option, this);
Source_t source = this->sources[index]; Source_t source = this->sources[index];