summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Mubashshir <ahmubashshir@gmail.com>2023-10-28 19:56:10 +0600
committerLibravatar Mubashshir <ahmubashshir@gmail.com>2023-10-28 19:56:10 +0600
commitd9bd6f314d7fe3efedae6a5c64078fdccc07831f (patch)
tree59202ce1728300c69984913259b26db151d77036
parenteca864a05e92639b343baa1883bb90c0b0bdb5e5 (diff)
downloadc-obp-example-d9bd6f314d7fe3efedae6a5c64078fdccc07831f.tar.gz
c-obp-example-d9bd6f314d7fe3efedae6a5c64078fdccc07831f.zip
Make use of new reference helpers
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
-rw-r--r--src/teams.c6
-rw-r--r--src/teams.h8
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 <stdint.h>
# include <stdbool.h>
# 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