mirror of
https://github.com/RubyMetric/chsrc
synced 2026-02-28 02:11:35 +08:00
Using Cook
This commit is contained in:
@@ -161,31 +161,31 @@ chef_set_chef (Target_t *target, char *name, char *email)
|
||||
|
||||
|
||||
void
|
||||
chef_set_sous_chefs (Target_t *target, size_t count, ...)
|
||||
chef_set_cooks (Target_t *target, size_t count, ...)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
target->sous_chefs = NULL;
|
||||
target->sous_chefs_n = 0;
|
||||
target->cooks = NULL;
|
||||
target->cooks_n = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, count);
|
||||
|
||||
target->sous_chefs = xy_malloc0 (count * sizeof(Contributor_t));
|
||||
target->sous_chefs_n = count;
|
||||
target->cooks = xy_malloc0 (count * sizeof(Contributor_t));
|
||||
target->cooks_n = count;
|
||||
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
char *name = va_arg(args, char*);
|
||||
char *email = va_arg(args, char*);
|
||||
|
||||
target->sous_chefs[i].name = xy_strdup(name);
|
||||
target->sous_chefs[i].email = xy_strdup(email);
|
||||
target->cooks[i].name = xy_strdup(name);
|
||||
target->cooks[i].email = xy_strdup(email);
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
|
||||
@@ -151,9 +151,9 @@ typedef struct Target_t
|
||||
Contributor_t *contributors;
|
||||
size_t contributors_n;
|
||||
|
||||
Contributor_t *chef; /* Chef 仅有一个 */
|
||||
Contributor_t *sous_chefs; /* Sous Chef 可以有多个 */
|
||||
size_t sous_chefs_n;
|
||||
Contributor_t *chef; /* Chef 仅有一个 */
|
||||
Contributor_t *cooks; /* Cook 可以有多个 */
|
||||
size_t cooks_n;
|
||||
}
|
||||
Target_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user