Skip to content

Commit

Permalink
Self_t -> mod/ctx are constant pointers.
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeDP committed Nov 23, 2018
1 parent 8553722 commit c6ac395
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Lib/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ module_ret_code module_register(const char *name, const char *ctx_name, const se
mod->subscriptions = map_new();
*self = memhook._malloc(sizeof(self_t));
self_t *s = (self_t *)*self;
s->mod = mod;
s->ctx = context;
*((module **)&s->mod) = mod;
*((m_context **)&s->ctx) = context;
mod->self = s;
evaluate_module(NULL, mod);
return MOD_OK;
Expand Down
4 changes: 2 additions & 2 deletions Lib/module_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ typedef struct {

/* Struct that holds self module informations, static to each module */
struct _self {
module *mod; // module's mod
m_context *ctx; // module's ctx
module *const mod; // self's mod
m_context *const ctx; // self's ctx
};

int evaluate_module(void *data, void *m);
Expand Down

0 comments on commit c6ac395

Please sign in to comment.