mirror of
https://github.com/RubyMetric/chsrc
synced 2026-02-02 15:50:29 +08:00
使用 chef_use_this()
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
@@ -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[] = {
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ os_freebsd_setsrc (char *option)
|
|||||||
// 据 @ykla,FreeBSD不自带sudo,但是我们依然要保证是root权限
|
// 据 @ykla,FreeBSD不自带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];
|
||||||
|
|||||||
Reference in New Issue
Block a user