|
2 | 2 | * SPDX-License-Identifier: GPL-3.0-or-later |
3 | 3 | * ------------------------------------------------------------- |
4 | 4 | * 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]> |
7 | 7 | * Created On : <2025-08-09> |
8 | | - * Last Modified : <2025-08-11> |
| 8 | + * Last Modified : <2025-08-20> |
9 | 9 | * |
10 | 10 | * chef DSL: for chefs (recipe makers) to define a target |
11 | 11 | * ------------------------------------------------------------*/ |
|
17 | 17 | #define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc; |
18 | 18 | #define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL; |
19 | 19 |
|
| 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 | + |
20 | 45 |
|
21 | 46 | /** |
22 | 47 | * @brief 修改 Provider 的测速地址 |
|
0 commit comments