From 8a3d52f4949dc731e51189a4e923b1b545ca8cfe Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sun, 23 Jul 2023 23:35:46 +0900 Subject: [PATCH] mruby-pack/pack.c (read_tmpl): rename PACK_DIR_INVALID The value is used for spaces and comments, so the term "skip" is more appropriate than "invalid". --- mrbgems/mruby-pack/src/pack.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mrbgems/mruby-pack/src/pack.c b/mrbgems/mruby-pack/src/pack.c index 8b7e00f84..bb06905a6 100644 --- a/mrbgems/mruby-pack/src/pack.c +++ b/mrbgems/mruby-pack/src/pack.c @@ -45,7 +45,7 @@ enum pack_dir { PACK_DIR_NUL, /* x */ PACK_DIR_BACK, /* X */ PACK_DIR_ABS, /* @ */ - PACK_DIR_INVALID + PACK_DIR_SKIP }; enum pack_type { @@ -1427,7 +1427,7 @@ read_tmpl(mrb_state *mrb, struct tmpl *tmpl, enum pack_dir *dirp, enum pack_type case '#': while (++tmpl->idx < tlen && tptr[tmpl->idx] != '\n') ; - dir = PACK_DIR_INVALID; + dir = PACK_DIR_SKIP; type = PACK_TYPE_NONE; return; @@ -1441,7 +1441,7 @@ read_tmpl(mrb_state *mrb, struct tmpl *tmpl, enum pack_dir *dirp, enum pack_type mrb_value s = mrb_str_new(mrb, &c, 1); mrb_raisef(mrb, E_ARGUMENT_ERROR, "unknown unpack directive %!v", s); } - dir = PACK_DIR_INVALID; + dir = PACK_DIR_SKIP; type = PACK_TYPE_NONE; break; } @@ -1516,7 +1516,7 @@ mrb_pack_pack(mrb_state *mrb, mrb_value ary) while (has_tmpl(&tmpl)) { read_tmpl(mrb, &tmpl, &dir, &type, &size, &count, &flags); - if (dir == PACK_DIR_INVALID) + if (dir == PACK_DIR_SKIP) continue; else if (dir == PACK_DIR_NUL) { grow: @@ -1648,7 +1648,7 @@ pack_unpack(mrb_state *mrb, mrb_value str, int single) while (has_tmpl(&tmpl)) { read_tmpl(mrb, &tmpl, &dir, &type, &size, &count, &flags); - if (dir == PACK_DIR_INVALID) + if (dir == PACK_DIR_SKIP) continue; else if (dir == PACK_DIR_NUL) { check_x(mrb, srclen-srcidx, count, 'x');