summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-14 03:38:34 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-16 03:52:50 +0000
commitc5f165a525dfcc3521f5e11cfaf023c632a7b131 (patch)
tree30a7e4593dd5b417c3164a18574a463f473d46cf
parenta08f8a4c2925c421d9e74604fa720034c5440376 (diff)
downloadzsh-c5f165a525dfcc3521f5e11cfaf023c632a7b131.tar.gz
zsh-c5f165a525dfcc3521f5e11cfaf023c632a7b131.zip
39310/0005: internals: match_str: Constify some local variables.
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/compmatch.c12
2 files changed, 9 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 9fddd78d9..617877541 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-09-16 Daniel Shahaf <d.s@daniel.shahaf.name>
+ * 39310/0005: Src/Zle/compmatch.c: internals: match_str:
+ Constify some local variables.
+
* 39310/0004: Src/Zle/compmatch.c: internals: match_str: Document
'savl'.
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index d32d9f1e1..5587bf37f 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -498,14 +498,17 @@ add_match_sub(Cmatcher m, char *l, int ll, char *w, int wl)
/**/
int
match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
- int sfx, int test, int part)
+ const int sfx, int test, int part)
{
int ll = strlen(l), lw = strlen(w), oll = ll, olw = lw, exact = 0, wexact = 0;
- int il = 0, iw = 0, t, ind, add, he = 0, bpc, obc = bc, bslash;
+ int il = 0, iw = 0, t, he = 0, bpc, bslash;
char *ow;
- Cmlist ms;
+ Cmlist ms; /* loop variable */
Cmatcher mp, lm = NULL;
Brinfo bp = NULL;
+ const int obc = bc;
+ const int ind = (sfx ? -1 : 0);
+ const int add = (sfx ? -1 : 1);
if (!test) {
start_match();
@@ -516,9 +519,6 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
if (sfx) {
l += ll; w += lw;
- ind = -1; add = -1;
- } else {
- ind = 0; add = 1;
}
/* ow will always point to the beginning (or end) of that sub-string
* in w that wasn't put in the match-variables yet. */