Skip to content

Commit f4718a0

Browse files
committed
添加 chef_register_contributor()
1 parent 6496ff0 commit f4718a0

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/framework/chef.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* SPDX-License-Identifier: GPL-3.0-or-later
33
* -------------------------------------------------------------
44
* File Name : chef.c
5-
* File Authors : Aoran Zeng <[email protected]>
6-
* Contributors : Nul None <[email protected]>
5+
* File Authors : 曾奥然 <[email protected]>
6+
* Contributors : Nul None <[email protected]>
77
* Created On : <2025-08-09>
8-
* Last Modified : <2025-08-11>
8+
* Last Modified : <2025-08-20>
99
*
1010
* chef DSL: for chefs (recipe makers) to define a target
1111
* ------------------------------------------------------------*/
@@ -17,6 +17,31 @@
1717
#define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc;
1818
#define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL;
1919

20+
/**
21+
* @brief 登记所有贡献者
22+
*
23+
* @param id 贡献者 ID,这个ID最好是GitHub用户名,但也可以不是,只需要在 chsrc 内部进行区分即可
24+
* @param display_name 如果没有提供该参数,则使用 name
25+
*/
26+
void
27+
chef_register_contributor (char *id, char *name, char *email, char *display_name)
28+
{
29+
if (!id || !name || !email)
30+
xy_unreached();
31+
32+
Contributor_t *contributor = xy_malloc0 (sizeof (Contributor_t));
33+
contributor->id = xy_strdup (id);
34+
contributor->name = xy_strdup (name);
35+
contributor->email = xy_strdup (email);
36+
37+
if (!display_name)
38+
contributor->display_name = xy_strdup (name);
39+
else
40+
contributor->display_name = xy_strdup (display_name);
41+
42+
xy_map_set (ProgStatus.contributors, id, contributor);
43+
}
44+
2045

2146
/**
2247
* @brief 修改 Provider 的测速地址

0 commit comments

Comments
 (0)