Fix typo `_hander` -> `_handler`.
MODIFY
include/mruby/irep.h
include/mruby/irep.h
@@ -44,7 +44,7 @@ enum mrb_catch_type {
MRB_CATCH_ENSURE = 1,
};
-struct mrb_irep_catch_hander {
+struct mrb_irep_catch_handler {
uint8_t type; /* enum mrb_catch_type */
uint8_t begin[2]; /* The starting address to match the hander. Includes this. */
uint8_t end[2]; /* The endpoint address that matches the hander. Not Includes this. */
@@ -125,14 +125,14 @@ struct mrb_insn_data {
struct mrb_insn_data mrb_decode_insn(const mrb_code *pc);
-static inline const struct mrb_irep_catch_hander *
+static inline const struct mrb_irep_catch_handler *
mrb_irep_catch_handler_table(const struct mrb_irep *irep)
{
if (irep->clen > 0) {
- return (const struct mrb_irep_catch_hander *)(irep->iseq + irep->ilen);
+ return (const struct mrb_irep_catch_handler*)(irep->iseq + irep->ilen);
}
else {
- return (const struct mrb_irep_catch_hander *)NULL;
+ return (const struct mrb_irep_catch_handler*)NULL;
}
}

MODIFY
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
@@ -71,7 +71,7 @@ typedef struct scope {
mrb_pool_value *pool;
mrb_sym *syms;
mrb_irep **reps;
- struct mrb_irep_catch_hander *catch_table;
+ struct mrb_irep_catch_handler *catch_table;
uint32_t pcapa, scapa, rcapa;
uint16_t nlocals;
@@ -97,8 +97,8 @@ static void loop_pop(codegen_scope *s, int val);
* - Larger start position
* - Same start position but smaller end position
*/
-static int catch_hander_new(codegen_scope *s);
-static void catch_hander_set(codegen_scope *s, int ent, enum mrb_catch_type type, uint32_t begin, uint32_t end, uint32_t target);
+static int catch_handler_new(codegen_scope *s);
+static void catch_handler_set(codegen_scope *s, int ent, enum mrb_catch_type type, uint32_t begin, uint32_t end, uint32_t target);
static void gen_assignment(codegen_scope *s, node *tree, int sp, int val);
static void gen_vmassignment(codegen_scope *s, node *tree, int rhs, int val);
@@ -1468,14 +1468,14 @@ codegen(codegen_scope *s, node *tree, int val)
if (tree->car == NULL) goto exit;
lp = loop_push(s, LOOP_BEGIN);
lp->pc0 = new_label(s);
- catch_entry = catch_hander_new(s);
+ catch_entry = catch_handler_new(s);
begin = s->pc;
codegen(s, tree->car, VAL);
pop();
lp->type = LOOP_RESCUE;
end = s->pc;
noexc = genjmp(s, OP_JMP, 0);
- catch_hander_set(s, catch_entry, MRB_CATCH_RESCUE, begin, end, s->pc);
+ catch_handler_set(s, catch_entry, MRB_CATCH_RESCUE, begin, end, s->pc);
tree = tree->cdr;
exend = 0;
pos1 = 0;
@@ -1558,7 +1558,7 @@ codegen(codegen_scope *s, node *tree, int val)
int catch_entry, begin, end, target;
int idx;
- catch_entry = catch_hander_new(s);
+ catch_entry = catch_handler_new(s);
begin = s->pc;
codegen(s, tree->car, val);
end = target = s->pc;
@@ -1570,7 +1570,7 @@ codegen(codegen_scope *s, node *tree, int val)
pop();
genop_1(s, OP_RAISEIF, idx);
pop();
- catch_hander_set(s, catch_entry, MRB_CATCH_ENSURE, begin, end, target);
+ catch_handler_set(s, catch_entry, MRB_CATCH_ENSURE, begin, end, target);
}
else { /* empty ensure ignored */
codegen(s, tree->car, val);
@@ -2038,14 +2038,14 @@ codegen(codegen_scope *s, node *tree, int val)
lp = loop_push(s, LOOP_BEGIN);
lp->pc0 = new_label(s);
- catch_entry = catch_hander_new(s);
+ catch_entry = catch_handler_new(s);
begin = s->pc;
exc = cursp();
codegen(s, tree->car, VAL);
end = s->pc;
noexc = genjmp(s, OP_JMP, 0);
lp->type = LOOP_RESCUE;
- catch_hander_set(s, catch_entry, MRB_CATCH_RESCUE, begin, end, s->pc);
+ catch_handler_set(s, catch_entry, MRB_CATCH_RESCUE, begin, end, s->pc);
genop_1(s, OP_EXCEPT, exc);
genop_1(s, OP_LOADF, exc);
dispatch(s, noexc);
@@ -3081,7 +3081,7 @@ scope_finish(codegen_scope *s)
}
irep->flags = 0;
if (s->iseq) {
- size_t catchsize = sizeof(struct mrb_irep_catch_hander) * irep->clen;
+ size_t catchsize = sizeof(struct mrb_irep_catch_handler) * irep->clen;
irep->iseq = (const mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->pc + catchsize);
irep->ilen = s->pc;
if (irep->clen > 0) {
@@ -3187,17 +3187,17 @@ loop_pop(codegen_scope *s, int val)
}
static int
-catch_hander_new(codegen_scope *s)
+catch_handler_new(codegen_scope *s)
{
- size_t newsize = sizeof(struct mrb_irep_catch_hander) * (s->irep->clen + 1);
- s->catch_table = (struct mrb_irep_catch_hander *)codegen_realloc(s, (void *)s->catch_table, newsize);
+ size_t newsize = sizeof(struct mrb_irep_catch_handler) * (s->irep->clen + 1);
+ s->catch_table = (struct mrb_irep_catch_handler *)codegen_realloc(s, (void *)s->catch_table, newsize);
return s->irep->clen ++;
}
static void
-catch_hander_set(codegen_scope *s, int ent, enum mrb_catch_type type, uint32_t begin, uint32_t end, uint32_t target)
+catch_handler_set(codegen_scope *s, int ent, enum mrb_catch_type type, uint32_t begin, uint32_t end, uint32_t target)
{
- struct mrb_irep_catch_hander *e;
+ struct mrb_irep_catch_handler *e;
mrb_assert(ent >= 0 && ent < s->irep->clen);
mrb_assert(begin < MAXARG_S);

MODIFY
src/codedump.c
src/codedump.c
@@ -83,7 +83,7 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
if (irep->clen > 0) {
int i = irep->clen;
- const struct mrb_irep_catch_hander *e = mrb_irep_catch_handler_table(irep);
+ const struct mrb_irep_catch_handler *e = mrb_irep_catch_handler_table(irep);
for (; i > 0; i --, e ++) {
int begin = bin_to_uint16(e->begin);

MODIFY
src/dump.c
src/dump.c
@@ -279,7 +279,7 @@ get_catch_table_block_size(mrb_state *mrb, const mrb_irep *irep)
size_t size = 0;
size += sizeof(uint16_t); /* number of catch handler */
- size += (sizeof(struct mrb_irep_catch_hander)) * irep->clen;
+ size += (sizeof(struct mrb_irep_catch_handler)) * irep->clen;
return size;
}
@@ -288,7 +288,7 @@ static ptrdiff_t
write_catch_table_block(mrb_state *mrb, const mrb_irep *irep, uint8_t *buf)
{
uint8_t *cur = buf;
- const struct mrb_irep_catch_hander *e = mrb_irep_catch_handler_table(irep);
+ const struct mrb_irep_catch_handler *e = mrb_irep_catch_handler_table(irep);
mrb_static_assert1(sizeof(*e) == 7);
if (e == NULL) return 0;

MODIFY
src/load.c
src/load.c
@@ -105,8 +105,8 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
if (irep->ilen > 0) {
size_t data_len = sizeof(mrb_code) * irep->ilen +
- sizeof(struct mrb_irep_catch_hander) * irep->clen;
- mrb_static_assert1(sizeof(struct mrb_irep_catch_hander) == 7);
+ sizeof(struct mrb_irep_catch_handler) * irep->clen;
+ mrb_static_assert1(sizeof(struct mrb_irep_catch_handler) == 7);
if (SIZE_ERROR_MUL(irep->ilen, sizeof(mrb_code))) {
return NULL;
}

MODIFY
src/vm.c
src/vm.c
@@ -788,13 +788,13 @@ break_new(mrb_state *mrb, uint32_t tag, const struct RProc *p, mrb_value val)
#define MRB_CATCH_FILTER_ENSURE (UINT32_C(1) << MRB_CATCH_ENSURE)
#define MRB_CATCH_FILTER_ALL (MRB_CATCH_FILTER_RESCUE | MRB_CATCH_FILTER_ENSURE)
-static const struct mrb_irep_catch_hander *
+static const struct mrb_irep_catch_handler *
catch_handler_find(mrb_state *mrb, mrb_callinfo *ci, const mrb_code *pc, uint32_t filter)
{
- mrb_irep *irep;
+ const mrb_irep *irep;
ptrdiff_t xpc;
size_t cnt;
- const struct mrb_irep_catch_hander *e;
+ const struct mrb_irep_catch_handler *e;
/* The comparison operators use `>` and `<=` because pc already points to the next instruction */
#define catch_cover_p(pc, beg, end) ((pc) > (beg) && (pc) <= (end))
@@ -1042,7 +1042,7 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc)
uint16_t b;
uint8_t c;
mrb_sym mid;
- const struct mrb_irep_catch_hander *ch;
+ const struct mrb_irep_catch_handler *ch;
#ifdef DIRECT_THREADED
static void *optable[] = {

Fix typo `_hander` -> `_handler`.