添加 chef_register_contributor()

This commit is contained in:
Aoran Zeng 2025-08-20 18:12:23 +08:00
parent 6496ff0b9e
commit f4718a05fd
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -2,10 +2,10 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Name : chef.c * File Name : chef.c
* File Authors : Aoran Zeng <ccmywish@qq.com> * File Authors : <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org> * Contributors : Nul None <nul@none.org>
* Created On : <2025-08-09> * Created On : <2025-08-09>
* Last Modified : <2025-08-11> * Last Modified : <2025-08-20>
* *
* chef DSL: for chefs (recipe makers) to define a target * chef DSL: for chefs (recipe makers) to define a target
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
@ -17,6 +17,31 @@
#define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc; #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_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL;
/**
* @brief
*
* @param id IDID最好是GitHub用户名 chsrc
* @param display_name 使 name
*/
void
chef_register_contributor (char *id, char *name, char *email, char *display_name)
{
if (!id || !name || !email)
xy_unreached();
Contributor_t *contributor = xy_malloc0 (sizeof (Contributor_t));
contributor->id = xy_strdup (id);
contributor->name = xy_strdup (name);
contributor->email = xy_strdup (email);
if (!display_name)
contributor->display_name = xy_strdup (name);
else
contributor->display_name = xy_strdup (display_name);
xy_map_set (ProgStatus.contributors, id, contributor);
}
/** /**
* @brief Provider * @brief Provider