diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-06-05 07:43:40 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 16:21:03 +0900 |
| commit | 5a3e014e4914dbd6421dbbd81e889cd6952e924b (patch) | |
| tree | 0975df1e1554c177d1b7adb1081d70d74c5bf505 /include | |
| parent | 744ba809198d79198246dbd6936a53fa98269ccb (diff) | |
| download | mruby-5a3e014e4914dbd6421dbbd81e889cd6952e924b.tar.gz mruby-5a3e014e4914dbd6421dbbd81e889cd6952e924b.zip | |
Constify `irep` members.
- `pool`
- `syms`
- `reps`
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby/debug.h | 2 | ||||
| -rw-r--r-- | include/mruby/dump.h | 6 | ||||
| -rw-r--r-- | include/mruby/irep.h | 9 | ||||
| -rw-r--r-- | include/mruby/proc.h | 6 |
4 files changed, 12 insertions, 11 deletions
diff --git a/include/mruby/debug.h b/include/mruby/debug.h index 5c5d56924..f22c7c77b 100644 --- a/include/mruby/debug.h +++ b/include/mruby/debug.h @@ -46,7 +46,7 @@ typedef struct mrb_irep_debug_info { * get line from irep's debug info and program counter * @return returns NULL if not found */ -MRB_API const char *mrb_debug_get_filename(mrb_state *mrb, mrb_irep *irep, ptrdiff_t pc); +MRB_API const char *mrb_debug_get_filename(mrb_state *mrb, const mrb_irep *irep, ptrdiff_t pc); /* * get line from irep's debug info and program counter diff --git a/include/mruby/dump.h b/include/mruby/dump.h index db3e287d3..2fa5e4d3c 100644 --- a/include/mruby/dump.h +++ b/include/mruby/dump.h @@ -18,10 +18,10 @@ MRB_BEGIN_DECL #define DUMP_DEBUG_INFO 1 -int mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size); +int mrb_dump_irep(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size); #ifndef MRB_DISABLE_STDIO -int mrb_dump_irep_binary(mrb_state*, mrb_irep*, uint8_t, FILE*); -int mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep*, uint8_t flags, FILE *f, const char *initname); +int mrb_dump_irep_binary(mrb_state*, const mrb_irep*, uint8_t, FILE*); +int mrb_dump_irep_cfunc(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname); mrb_irep *mrb_read_irep_file(mrb_state*, FILE*); MRB_API mrb_value mrb_load_irep_file(mrb_state*,FILE*); MRB_API mrb_value mrb_load_irep_file_cxt(mrb_state*, FILE*, mrbc_context*); diff --git a/include/mruby/irep.h b/include/mruby/irep.h index 661ef2b48..6633bc73e 100644 --- a/include/mruby/irep.h +++ b/include/mruby/irep.h @@ -33,11 +33,11 @@ typedef struct mrb_irep { uint8_t flags; const mrb_code *iseq; - mrb_value *pool; - mrb_sym *syms; - struct mrb_irep **reps; + const mrb_value *pool; + const mrb_sym *syms; + const struct mrb_irep **reps; - struct mrb_locals *lv; + const struct mrb_locals *lv; /* debug info */ struct mrb_irep_debug_info* debug_info; @@ -46,6 +46,7 @@ typedef struct mrb_irep { } mrb_irep; #define MRB_ISEQ_NO_FREE 1 +#define MRB_IREP_NO_FREE 2 MRB_API mrb_irep *mrb_add_irep(mrb_state *mrb); diff --git a/include/mruby/proc.h b/include/mruby/proc.h index 12013c3ae..2d06210ef 100644 --- a/include/mruby/proc.h +++ b/include/mruby/proc.h @@ -41,7 +41,7 @@ void mrb_env_unshare(mrb_state*, struct REnv*); struct RProc { MRB_OBJECT_HEADER; union { - mrb_irep *irep; + const mrb_irep *irep; mrb_func_t func; } body; struct RProc *upper; @@ -86,8 +86,8 @@ struct RProc { #define mrb_proc_ptr(v) ((struct RProc*)(mrb_ptr(v))) -struct RProc *mrb_proc_new(mrb_state*, mrb_irep*); -struct RProc *mrb_closure_new(mrb_state*, mrb_irep*); +struct RProc *mrb_proc_new(mrb_state*, const mrb_irep*); +struct RProc *mrb_closure_new(mrb_state*, const mrb_irep*); MRB_API struct RProc *mrb_proc_new_cfunc(mrb_state*, mrb_func_t); MRB_API struct RProc *mrb_closure_new_cfunc(mrb_state *mrb, mrb_func_t func, int nlocals); void mrb_proc_copy(struct RProc *a, struct RProc *b); |
