I found that for optimization purposes common cases in re_string_peek_byte are missed if pstr->mbs_allocated is true, thus skipping them also for case insensitive.

My solution would be to return re_string_peek_byte also if pstr->icase is true. mbs_allocated is changed also depending on icase but I don't think we want to change it globally, so I think my patch should be fine and not affect optimization.

Please check the attachment. If the patch is fine should I also send this to gnulib mailing list to have it submitted or is this one enough?

Best regards,
Tomasz Dziendzielski