Skip to content

Commit c6ac395

Browse files
committed
Self_t -> mod/ctx are constant pointers.
1 parent 8553722 commit c6ac395

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Lib/module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ module_ret_code module_register(const char *name, const char *ctx_name, const se
115115
mod->subscriptions = map_new();
116116
*self = memhook._malloc(sizeof(self_t));
117117
self_t *s = (self_t *)*self;
118-
s->mod = mod;
119-
s->ctx = context;
118+
*((module **)&s->mod) = mod;
119+
*((m_context **)&s->ctx) = context;
120120
mod->self = s;
121121
evaluate_module(NULL, mod);
122122
return MOD_OK;

Lib/module_priv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ typedef struct {
8484

8585
/* Struct that holds self module informations, static to each module */
8686
struct _self {
87-
module *mod; // module's mod
88-
m_context *ctx; // module's ctx
87+
module *const mod; // self's mod
88+
m_context *const ctx; // self's ctx
8989
};
9090

9191
int evaluate_module(void *data, void *m);

0 commit comments

Comments
 (0)