about summary refs log tree commit diff
path: root/Src/Zle/compmatch.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-14 03:38:35 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-16 03:54:03 +0000
commitf37fa9293fa128e657d4e124ac1aa25086f65847 (patch)
tree2074dfd1603d71a18772e6c901fef7a5cfc1aa94 /Src/Zle/compmatch.c
parent31665068c12a0df574d490596f166886d6172405 (diff)
downloadzsh-f37fa9293fa128e657d4e124ac1aa25086f65847.tar.gz
zsh-f37fa9293fa128e657d4e124ac1aa25086f65847.tar.xz
zsh-f37fa9293fa128e657d4e124ac1aa25086f65847.zip
39310/0008: internals: match_str: Document several local variables.
Diffstat (limited to 'Src/Zle/compmatch.c')
-rw-r--r--Src/Zle/compmatch.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index f670de781..0c6270dee 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -500,8 +500,16 @@ int
 match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 	  const int sfx, int test, int part)
 {
-    int ll = strlen(l), lw = strlen(w), exact = 0, wexact = 0;
-    int il = 0, iw = 0, t, he = 0, bslash;
+    /* How many characters from the line string and from the word string are
+     * yet to be matched. */
+    int ll = strlen(l), lw = strlen(w);
+    /* Number of characters from the line string and word string matched. */
+    int il = 0, iw = 0;
+    /* How many characters were matched exactly in the line and in the word. */
+    int exact = 0, wexact = 0;
+    int he = 0;
+    int bslash;
+    int t;
     char *ow;
     Cmlist ms; /* loop variable */
     Cmatcher mp, lm = NULL;
@@ -511,6 +519,8 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
     const int add = (sfx ? -1 : 1);
     const int original_ll = ll, original_lw = lw;
 
+    /* INVARIANT: il+ll == original_ll; iw+lw == original_lw */
+
     if (!test) {
 	start_match();
 	bp = *bpp;
@@ -629,6 +639,10 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 		    int moff;
 		    /*
 		     * ### These two are related.
+		     *
+		     * ### They may have a relation similar to that of lw/iw
+		     * ### (q.v.), at least during the 'for' loop.  They may be
+		     * ### overloaded/repurposed after it.
 		     */
 		    int ct, ict;
 		    /*