~vcs-imports/pmake/main

Viewing all changes in revision 4167.

  • Committer: rillig
  • Date: 2021-04-12 18:48:00 UTC
  • Revision ID: rillig-20210412184800-1pem5s72iyev92xo
make: reduce memory allocation and strlen calls in modifier ':from=to'

Previously, SysVMatch was quite verbose and felt like hand-optimized
assembler code, which made it difficult to discover the underlying idea
of the code.

All this code was replaced with two simple calls to Substring_HasPrefix
and Substring_HasSuffix.  Now that the operands of that modifier are no
longer passed as C strings, there is no need to collect all information
in a single scan through the word and the pattern.

It was not necessary to call Var_Subst unconditionally.  Calling it only
when the string contains a '$' saves another memory allocation and two
string copies (because of the Buf_DoneDataCompact).

No functional change.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: