Debian Codegraph @

examples/bundle-foo/ffi/foo.c

raw
1 #include <ffi_platypus_bundle.h>
2 #include <string.h>
3
4 typedef struct {
5 char *name;
6 int value;
7 } foo_t;
8
9 foo_t*
10 foo__new(const char *class_name, const char *name, int value) {
11 (void)class_name;
12 foo_t *self = malloc( sizeof( foo_t ) );
13 self->name = strdup(name);
14 self->value = value;
15 return self;
16 }
17
18 const char *
19 foo__name(foo_t *self) {
20 return self->name;
21 }
22
23 int
24 foo__value(foo_t *self) {
25 return self->value;
26 }
27
28 void
29 foo__DESTROY(foo_t *self) {
30 free(self->name);
31 free(self);
32 }