summaryrefslogtreecommitdiff
path: root/src/teams.c
diff options
context:
space:
mode:
authorLibravatar Mubashshir <ahmubashshir@gmail.com>2023-10-28 20:05:49 +0600
committerLibravatar Mubashshir <ahmubashshir@gmail.com>2023-10-28 20:05:49 +0600
commit7455c3d0bda6ab60d3f67fafd0ce04428143bcbe (patch)
tree4a139278995f0602469b10223aaa448ae0a967f9 /src/teams.c
parentc47100c331e1fcc4353b6ed83a1d3485c9331eaf (diff)
downloadc-obp-example-7455c3d0bda6ab60d3f67fafd0ce04428143bcbe.tar.gz
c-obp-example-7455c3d0bda6ab60d3f67fafd0ce04428143bcbe.zip
Use better names for reference helpers
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
Diffstat (limited to 'src/teams.c')
-rw-r--r--src/teams.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/teams.c b/src/teams.c
index 9b6d37b..a3bf0a2 100644
--- a/src/teams.c
+++ b/src/teams.c
@@ -15,7 +15,7 @@ typedef struct team_impl_struct {
// base functions
NEW(team, {
- return (TEAM_impl *)malloc(sizeof(TEAM_impl));
+ return (ptr(TEAM_impl))malloc(sizeof(TEAM_impl));
})
DEL(team, {
@@ -24,17 +24,17 @@ DEL(team, {
// Setter definitions
// @set char[]: TEAM.name -> bool
-SETTER(team, name, const ref(char), {
+SETTER(team, name, ref(char), {
return !(strncpy(self->name, value, 255) == NULL);
})
// @set char[]: TEAM.institution -> bool
-SETTER(team, institution, const ref(char), {
+SETTER(team, institution, ref(char), {
return !(strncpy(self->institution, value, 255) == NULL);
})
// @set char[]: TEAM.member_name, int: id -> bool
-SETTER(team, member_name, const ref(char), {
+SETTER(team, member_name, ref(char), {
return (id > 0 && id < 4 && !(strncpy(self->members[id-1], value, 255) == NULL));
}, int id)
@@ -47,12 +47,12 @@ SETTER(team, solved, uint8_t, {
// Getter definitions
// @get TEAM.name -> char[]
-GETTER(team, name, char *, {
+GETTER(team, name, ptr(char), {
return self->name;
})
// @get TEAM.institution -> char[]
-GETTER(team, institution, char *, {
+GETTER(team, institution, ptr(char), {
return self->institution;
})
@@ -62,7 +62,7 @@ GETTER(team, solved, uint8_t, {
})
// @get TEAM.member_name, id -> char[]
-GETTER(team, member_name, char *, {
+GETTER(team, member_name, ptr(char), {
return (id > 0 && id < 4)? self->members[id - 1] : "(incorrect id)";
}, int id)
@@ -84,7 +84,7 @@ DEFINE(team, fprintf, int, {
self->members[0],
self->members[1],
self->members[2]);
-}, FILE *file)
+}, ptr(FILE) file)
DEFINE(team, find_champion, team, {
UNUSED(self);
@@ -94,4 +94,4 @@ DEFINE(team, find_champion, team, {
if ( teams[num]->solved > champion->solved )
champion = teams[num];
return champion;
-}, team *teams, unsigned num)
+}, ptr(team) teams, unsigned num)