pack.c: reduce dispatch in `pack_unpack()`.
MODIFY
mrbgems/mruby-pack/src/pack.c
mrbgems/mruby-pack/src/pack.c
@@ -1501,26 +1501,24 @@ pack_unpack(mrb_state *mrb, mrb_value str, int single)
continue;
}
- if (flags & PACK_FLAG_COUNT2) {
sptr = (const unsigned char *)RSTRING_PTR(str) + srcidx;
switch (dir) {
case PACK_DIR_HEX:
srcidx += unpack_h(mrb, sptr, srclen - srcidx, result, count, flags);
- break;
+ continue;
case PACK_DIR_STR:
srcidx += unpack_a(mrb, sptr, srclen - srcidx, result, count, flags);
- break;
+ continue;
case PACK_DIR_BASE64:
srcidx += unpack_m(mrb, sptr, srclen - srcidx, result);
+ continue;
break;
case PACK_DIR_QENC:
srcidx += unpack_M(mrb, sptr, srclen - srcidx, result);
- break;
+ continue;
default:
break;
}
- continue;
- }
while (count != 0) {
if (srclen - srcidx < size) {

pack.c: reduce dispatch in `pack_unpack()`.