summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3b27a3e)
* src/matcher.c
* src/matcher.h
Optimize back yesterday's fix.
+2005-11-30 [colin] 1.9.100cvs46
+
+ * src/matcher.c
+ * src/matcher.h
+ Optimize back yesterday's fix.
+
2005-11-30 [paul] 1.9.100cvs45
* manual/faq.xml
2005-11-30 [paul] 1.9.100cvs45
* manual/faq.xml
( cvs diff -u -r 1.75.2.11 -r 1.75.2.12 src/matcher.c; ) > 1.9.100cvs43.patchset
( cvs diff -u -r 1.75.2.12 -r 1.75.2.13 src/matcher.c; ) > 1.9.100cvs44.patchset
( cvs diff -u -r 1.1.2.4 -r 1.1.2.5 manual/faq.xml; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 manual/intro.xml; ) > 1.9.100cvs45.patchset
( cvs diff -u -r 1.75.2.11 -r 1.75.2.12 src/matcher.c; ) > 1.9.100cvs43.patchset
( cvs diff -u -r 1.75.2.12 -r 1.75.2.13 src/matcher.c; ) > 1.9.100cvs44.patchset
( cvs diff -u -r 1.1.2.4 -r 1.1.2.5 manual/faq.xml; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 manual/intro.xml; ) > 1.9.100cvs45.patchset
+( cvs diff -u -r 1.75.2.13 -r 1.75.2.14 src/matcher.c; cvs diff -u -r 1.39.2.5 -r 1.39.2.6 src/matcher.h; ) > 1.9.100cvs46.patchset
MICRO_VERSION=100
INTERFACE_AGE=0
BINARY_AGE=0
MICRO_VERSION=100
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
GSList *l;
gchar buf[BUFFSIZE];
GSList *l;
gchar buf[BUFFSIZE];
- for (l = matchers->matchers ; l != NULL ; l = g_slist_next(l)) {
- MatcherProp *matcher = (MatcherProp *) l->data;
+ while (procheader_get_one_field(buf, sizeof(buf), fp, NULL) != -1) {
+ for (l = matchers->matchers ; l != NULL ; l = g_slist_next(l)) {
+ MatcherProp *matcher = (MatcherProp *) l->data;
- while (procheader_get_one_field(buf, sizeof(buf), fp, NULL) != -1) {
+ if (matcher->done)
+ continue;
/* if the criteria is ~headers_part or ~message, ZERO lines
* must NOT match for the rule to match. */
/* if the criteria is ~headers_part or ~message, ZERO lines
* must NOT match for the rule to match. */
matcher->criteria == MATCHCRITERIA_NOT_MESSAGE) {
if (matcherprop_match_one_header(matcher, buf)) {
matcher->result = TRUE;
matcher->criteria == MATCHCRITERIA_NOT_MESSAGE) {
if (matcherprop_match_one_header(matcher, buf)) {
matcher->result = TRUE;
- continue; /* must check all lines */
} else {
matcher->result = FALSE;
} else {
matcher->result = FALSE;
- break; /* no need to check more */
}
/* else, just one line matching is enough for the rule to match
*/
}
/* else, just one line matching is enough for the rule to match
*/
matcherprop_criteria_message(matcher)){
if (matcherprop_match_one_header(matcher, buf)) {
matcher->result = TRUE;
matcherprop_criteria_message(matcher)){
if (matcherprop_match_one_header(matcher, buf)) {
matcher->result = TRUE;
- break; /* no need to check more */
- }
-
- /* if the rule matched and the matchers are OR, no need to
- * check the others */
- if (matcherprop_criteria_headers(matcher)) {
- if (matcher->result) {
+
+ /* if the rule matched and the matchers are OR, no need to
+ * check the others */
+ if (matcher->result && matcher->done) {
if (!matchers->bool_and)
return TRUE;
}
}
if (!matchers->bool_and)
return TRUE;
}
}
-
- /* go back to beginning of file */
- rewind(fp);
GSList *l;
gchar buf[BUFFSIZE];
GSList *l;
gchar buf[BUFFSIZE];
- for (l = matchers->matchers ; l != NULL ; l = g_slist_next(l)) {
- MatcherProp *matcher = (MatcherProp *) l->data;
-
- rewind(fp);
- if (!matcherprop_criteria_message(matcher))
- matcherlist_skip_headers(fp);
-
- while (fgets(buf, sizeof(buf), fp) != NULL) {
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ for (l = matchers->matchers ; l != NULL ; l = g_slist_next(l)) {
+ MatcherProp *matcher = (MatcherProp *) l->data;
+ if (matcher->done)
+ continue;
+
/* if the criteria is ~body_part or ~message, ZERO lines
* must NOT match for the rule to match. */
if (matcher->criteria == MATCHCRITERIA_NOT_BODY_PART ||
matcher->criteria == MATCHCRITERIA_NOT_MESSAGE) {
if (matcherprop_match_line(matcher, buf)) {
matcher->result = TRUE;
/* if the criteria is ~body_part or ~message, ZERO lines
* must NOT match for the rule to match. */
if (matcher->criteria == MATCHCRITERIA_NOT_BODY_PART ||
matcher->criteria == MATCHCRITERIA_NOT_MESSAGE) {
if (matcherprop_match_line(matcher, buf)) {
matcher->result = TRUE;
- continue; /* must check all lines */
} else {
matcher->result = FALSE;
} else {
matcher->result = FALSE;
- break; /* no need to check more */
}
/* else, just one line has to match */
} else if (matcherprop_criteria_body(matcher) ||
matcherprop_criteria_message(matcher)) {
if (matcherprop_match_line(matcher, buf)) {
matcher->result = TRUE;
}
/* else, just one line has to match */
} else if (matcherprop_criteria_body(matcher) ||
matcherprop_criteria_message(matcher)) {
if (matcherprop_match_line(matcher, buf)) {
matcher->result = TRUE;
- break; /* no need to check more */
- /* if the matchers are OR'ed and the rule matched,
- * no need to check the others. */
- if (matcher->result) {
- if (!matchers->bool_and)
- return TRUE;
+ /* if the matchers are OR'ed and the rule matched,
+ * no need to check the others. */
+ if (matcher->result && matcher->done) {
+ if (!matchers->bool_and)
+ return TRUE;
+ }
read_body = TRUE;
}
matcher->result = FALSE;
read_body = TRUE;
}
matcher->result = FALSE;
}
if (!read_headers && !read_body)
}
if (!read_headers && !read_body)
if (read_headers) {
if (matcherlist_match_headers(matchers, fp))
read_body = FALSE;
if (read_headers) {
if (matcherlist_match_headers(matchers, fp))
read_body = FALSE;
+ } else {
+ matcherlist_skip_headers(fp);
regex_t *preg;
int error;
gboolean result;
regex_t *preg;
int error;
gboolean result;
};
typedef struct _MatcherProp MatcherProp;
};
typedef struct _MatcherProp MatcherProp;