From ff1ba1e770b4205c2cc367ff513325e5f22c73e8 Mon Sep 17 00:00:00 2001 From: Mubashshir Date: Mon, 19 May 2025 14:08:11 +0600 Subject: Code cleanup and reuse Signed-off-by: Mubashshir --- src/teams.h | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'src/teams.h') diff --git a/src/teams.h b/src/teams.h index 15aad82..c65bad3 100644 --- a/src/teams.h +++ b/src/teams.h @@ -6,29 +6,15 @@ # include "common.h" // Type definition -CLASS(team); - -// base functions -NEW(team); -DEL(team); - -// field getters -SETTER(team, name, ref(char)); -SETTER(team, institution, ref(char)); -SETTER(team, member_name, ref(char), int); -SETTER(team, solved, uint8_t); - -// field setters -GETTER(team, name, ptr(char)); -GETTER(team, institution, ptr(char)); -GETTER(team, member_name, ptr(char), int); -GETTER(team, solved, uint8_t); - -// helper functions -DEFINE(team, printf, int); -DEFINE(team, fprintf, int, ptr(FILE)); -DEFINE(team, find_champion, team, ptr(team), unsigned); - +CLASS( team, { + LIST(team, name, char, [255]); + LIST(team, member_name, char, [3][255], int); + LIST(team, institution, char, [255]); + ATOM(team, solved, uint8_t); + FUNC(team, printf, int); + FUNC(team, fprintf, int, FILE *); + FUNC(team, find_champion, team, ptr(team), size_t); +}); # include "cobj.h" #endif /* __TEAMS_H__ */ /* vim: ts=8 */ -- cgit v1.2.3