diff options
| author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2016-09-14 03:38:34 +0000 |
|---|---|---|
| committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2016-09-16 03:52:37 +0000 |
| commit | 59aabe483c321f9122ea9998b0f0797eabe2aa6c (patch) | |
| tree | 4da6beae4d76d4046396512c5fc3c90fc025bd4f | |
| parent | 39310/0002: internals: match_str: Simplify by removing 'zoff'. (diff) | |
| download | zsh-59aabe483c321f9122ea9998b0f0797eabe2aa6c.tar zsh-59aabe483c321f9122ea9998b0f0797eabe2aa6c.tar.gz zsh-59aabe483c321f9122ea9998b0f0797eabe2aa6c.tar.bz2 zsh-59aabe483c321f9122ea9998b0f0797eabe2aa6c.tar.lz zsh-59aabe483c321f9122ea9998b0f0797eabe2aa6c.tar.xz zsh-59aabe483c321f9122ea9998b0f0797eabe2aa6c.tar.zst zsh-59aabe483c321f9122ea9998b0f0797eabe2aa6c.zip | |
39310/0003: internals: match_str: Document 'savw'. Avoid magic number.
All callees checked to ensure that they only check that parameter for nonzeroness.
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | Src/Zle/compmatch.c | 9 |
2 files changed, 9 insertions, 3 deletions
@@ -1,5 +1,8 @@ 2016-09-16 Daniel Shahaf <d.s@daniel.shahaf.name> + * 39310/0003: Src/Zle/compmatch.c: internals: match_str: Document + 'savw'. Avoid magic number. + * 39310/0002: Src/Zle/compmatch.c: internals: match_str: Simplify by removing 'zoff'. diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c index 82cda6128..a3988d542 100644 --- a/Src/Zle/compmatch.c +++ b/Src/Zle/compmatch.c @@ -641,7 +641,7 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp, * the temporal lobe. Reward promised for its safe return. * Contact zsh-workers@zsh.org. */ - char *tp, savl = '\0', savw; + char *tp, savl = '\0'; /* * The anchor on this end. */ @@ -721,15 +721,18 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp, !match_parts(l + aoff , tp - moff, alen, part)) break; if (sfx) { + /* Call ourselves recursively with the + * anchor removed. */ + char savw; if ((savw = tp[-alen])) tp[-alen] = '\0'; t = match_str(l - ll, w - lw, - NULL, 0, NULL, 1, 2, part); + NULL, 0, NULL, sfx, 2, part); if (savw) tp[-alen] = savw; } else t = match_str(l + llen + moff, tp + moff, - NULL, 0, NULL, 0, 1, part); + NULL, 0, NULL, sfx, 1, part); if (t || (mp->wlen == -1 && !both)) break; } |
