]> git.tue.mpg.de Git - paraslash.git/commitdiff
afs.c: Remove compatibility code in action_if_pattern_matches().
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 2 Oct 2015 02:34:53 +0000 (02:34 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Mar 2017 09:02:28 +0000 (11:02 +0200)
This is no longer needed as there are no more non-lopsub
commands left. Now pmd->lpr is non-NULL for all commands which
call action_if_pattern_matches(), which allows to simplify the
function. Moreover, ->patterns of struct pattern_match_data is unused
and can be dropped.

afs.c
afs.h

diff --git a/afs.c b/afs.c
index f51039b1dbc3bcd8b329bf5bf802898569f5d353..fbcffddef8d3669888be7711e097ebf07666012d 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -317,31 +317,26 @@ static int action_if_pattern_matches(struct osl_row *row, void *data)
        struct pattern_match_data *pmd = data;
        struct osl_object name_obj;
        const char *p, *name;
-       int i, ret = osl(osl_get_object(pmd->table, row, pmd->match_col_num, &name_obj));
-       const char *pattern_txt = (const char *)pmd->patterns.data;
+       int i, ret;
 
+       ret = osl(osl_get_object(pmd->table, row, pmd->match_col_num,
+               &name_obj));
        if (ret < 0)
                return ret;
        name = (char *)name_obj.data;
        if ((!name || !*name) && (pmd->pm_flags & PM_SKIP_EMPTY_NAME))
                return 1;
-       if ((pmd->lpr && lls_num_inputs(pmd->lpr) == 0) || pmd->patterns.size == 0) {
+       if (lls_num_inputs(pmd->lpr) == 0) {
                if (pmd->pm_flags & PM_NO_PATTERN_MATCHES_EVERYTHING) {
                        pmd->num_matches++;
                        return pmd->action(pmd->table, row, name, pmd->data);
                }
        }
-       p = pattern_txt;
        i = pmd->input_skip;
        for (;;) {
-               if (pmd->lpr) {
-                       if (i >= lls_num_inputs(pmd->lpr))
-                               break;
-                       p = lls_input(i, pmd->lpr);
-               } else {
-                       if (p >= pattern_txt + pmd->patterns.size)
-                               break;
-               }
+               if (i >= lls_num_inputs(pmd->lpr))
+                       break;
+               p = lls_input(i, pmd->lpr);
                ret = fnmatch(p, name, pmd->fnmatch_flags);
                if (ret != FNM_NOMATCH) {
                        if (ret != 0)
@@ -352,10 +347,7 @@ static int action_if_pattern_matches(struct osl_row *row, void *data)
                        return ret;
 
                }
-               if (pmd->lpr)
-                       i++;
-               else
-                       p += strlen(p) + 1;
+               i++;
        }
        return 1;
 }
diff --git a/afs.h b/afs.h
index 3ff94f3b51e0ec5b3198cf037f25a6c8b958f198..879331ec85b244a31fb56287ce15e2192701d911 100644 (file)
--- a/afs.h
+++ b/afs.h
@@ -147,8 +147,6 @@ struct pattern_match_data {
        int fnmatch_flags;
        /** Obtained by deserializing the query buffer in the callback. */
        struct lls_parse_result *lpr;
-       /** Null-terminated array of patterns. */
-       struct osl_object patterns;
        /** Do not try to match the first inputs of lpr */
        unsigned input_skip;
        /** Data pointer passed to the action function. */