File: module.c

package info (click to toggle)
yambar 1.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,224 kB
  • sloc: ansic: 17,135; xml: 679; sh: 155; yacc: 108; lex: 79; makefile: 9
file content (28 lines) | stat: -rw-r--r-- 516 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "module.h"
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>

struct module *
module_common_new(void)
{
    struct module *mod = calloc(1, sizeof(*mod));
    mtx_init(&mod->lock, mtx_plain);
    mod->destroy = &module_default_destroy;
    return mod;
}

void
module_default_destroy(struct module *mod)
{
    mtx_destroy(&mod->lock);
    free(mod);
}

struct exposable *
module_begin_expose(struct module *mod)
{
    struct exposable *e = mod->content(mod);
    e->begin_expose(e);
    return e;
}