> We should probably use something like
>
>     ptrdiff_t
>     search_regs_last_reg (void)
>     {
>       ptrdiff_t i = search_regs.num_regs - 1;
>       while (i >= 0 && search_regs.start[i] < 0)
>         i--;
>       return i;
>     }
>
> instead of `search_regs.num_regs`.

And maybe we should consider changing `struct re_search` to keep track
of the last non-nil subgroup.  Currently, things like `match-data` loop
through all the elements of `search_regs` whose size depends on the
size (in number of subgroups) of the largest regexp we have ever matched
so far, rather than the actual number of subgroups currently in use, so
there's some wasted work there.  Maybe the cost of maintaining the "last
reg" would pay off.


        Stefan




  • bug#73018:... Juri Linkov
    • bug#7... Bug reports for GNU Emacs, the Swiss army knife of text editors
      • b... Bug reports for GNU Emacs, the Swiss army knife of text editors
        • ... Juri Linkov
        • ... Bug reports for GNU Emacs, the Swiss army knife of text editors
        • ... Juri Linkov
        • ... Bug reports for GNU Emacs, the Swiss army knife of text editors
        • ... Juri Linkov
        • ... Juri Linkov
        • ... Bug reports for GNU Emacs, the Swiss army knife of text editors
        • ... Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply via email to