From d9bd6f314d7fe3efedae6a5c64078fdccc07831f Mon Sep 17 00:00:00 2001 From: Mubashshir Date: Sat, 28 Oct 2023 19:56:10 +0600 Subject: Make use of new reference helpers Signed-off-by: Mubashshir --- src/teams.c | 6 +++--- src/teams.h | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/teams.c b/src/teams.c index e8dbf74..9b6d37b 100644 --- a/src/teams.c +++ b/src/teams.c @@ -24,17 +24,17 @@ DEL(team, { // Setter definitions // @set char[]: TEAM.name -> bool -SETTER(team, name, char *, { +SETTER(team, name, const ref(char), { return !(strncpy(self->name, value, 255) == NULL); }) // @set char[]: TEAM.institution -> bool -SETTER(team, institution, char *, { +SETTER(team, institution, const ref(char), { return !(strncpy(self->institution, value, 255) == NULL); }) // @set char[]: TEAM.member_name, int: id -> bool -SETTER(team, member_name, char *, { +SETTER(team, member_name, const ref(char), { return (id > 0 && id < 4 && !(strncpy(self->members[id-1], value, 255) == NULL)); }, int id) diff --git a/src/teams.h b/src/teams.h index e22b262..342ce95 100644 --- a/src/teams.h +++ b/src/teams.h @@ -3,6 +3,8 @@ # include # include # include "cobj.h" +# include "common.h" + // Type definition typedef struct team_impl_struct * team; @@ -11,9 +13,9 @@ NEW(team); DEL(team); // field getters -SETTER(team, name, char *); -SETTER(team, institution, char *); -SETTER(team, member_name, char *, int); +SETTER(team, name, const ref(char)); +SETTER(team, institution, const ref(char)); +SETTER(team, member_name, const ref(char), int); SETTER(team, solved, uint8_t); // field setters -- cgit v1.2.3