MEDIUM: filters: Use macros to call filters callbacks to speed-up processing

When no filter is attached to the stream, the CPU footprint due to the calls to
filters_* functions is huge, especially for chunk-encoded messages. Using macros
to check if we have some filters or not is a great improvement.

Furthermore, instead of checking the filter list emptiness, we introduce a flag
to know if filters are attached or not to a stream.
diff --git a/src/filters.c b/src/filters.c
index 974c742..01dc5fa 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -295,6 +295,7 @@
 	f->conf  = filter->conf;
 	f->is_backend_filter = is_backend;
 	LIST_ADDQ(&s->strm_flt.filters, &f->list);
+	s->strm_flt.has_filters = 1;
 	return 0;
 }
 
@@ -309,6 +310,7 @@
 
 	LIST_INIT(&s->strm_flt.filters);
 	memset(s->strm_flt.current, 0, sizeof(s->strm_flt.current));
+	s->strm_flt.has_filters = 0;
 	list_for_each_entry(filter, &strm_fe(s)->filters, list) {
 		if (flt_stream_add_filter(s, filter, 0) < 0)
 			return -1;
@@ -333,6 +335,8 @@
 			pool_free2(pool2_filter, filter);
 		}
 	}
+	if (LIST_ISEMPTY(&s->strm_flt.filters))
+		s->strm_flt.has_filters = 0;
 }
 
 /*
@@ -393,9 +397,6 @@
 	struct filter *filter;
 	int            ret = 1;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		goto end;
-
 	RESUME_FILTER_LOOP(s, msg->chn) {
 		if (filter->ops  && filter->ops->http_headers) {
 			ret = filter->ops->http_headers(s, filter, msg);
@@ -419,9 +420,6 @@
 {
 	int ret = 1;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		goto end;
-
 	RESUME_FILTER_LOOP(s, msg->chn) {
 		if (filter->ops->http_start_chunk) {
 			ret = filter->ops->http_start_chunk(s, filter, msg);
@@ -450,12 +448,6 @@
 	unsigned int   buf_i;
 	int            ret = 0;
 
-	/* No filter, consume all available data */
-	if (LIST_ISEMPTY(&s->strm_flt.filters)) {
-		ret = MIN(msg->chunk_len, msg->chn->buf->i - msg->next);
-		goto end;
-	}
-
 	/* Save buffer state */
 	buf_i = msg->chn->buf->i;
 	list_for_each_entry(filter, &s->strm_flt.filters, list) {
@@ -483,7 +475,6 @@
 	}
 	/* Restore the original buffer state */
 	msg->chn->buf->i = buf_i;
- end:
 	return ret;
 }
 
@@ -492,9 +483,6 @@
 {
 	int ret = 1;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		goto end;
-
 	RESUME_FILTER_LOOP(s, msg->chn) {
 		if (filter->ops->http_end_chunk) {
 			ret = filter->ops->http_end_chunk(s, filter, msg);
@@ -513,9 +501,6 @@
 {
 	int ret = 1;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		goto end;
-
 	RESUME_FILTER_LOOP(s, msg->chn) {
 		if (filter->ops->http_last_chunk) {
 			ret = filter->ops->http_last_chunk(s, filter, msg);
@@ -543,9 +528,6 @@
 {
 	int ret = 1;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		goto end;
-
 	RESUME_FILTER_LOOP(s, msg->chn) {
 		if (filter->ops->http_chunk_trailers) {
 			ret = filter->ops->http_chunk_trailers(s, filter, msg);
@@ -570,9 +552,6 @@
 {
 	int ret = 1;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		goto end;
-
 	RESUME_FILTER_LOOP(s, msg->chn) {
 		if (filter->ops->http_end) {
 			ret = filter->ops->http_end(s, filter, msg);
@@ -594,9 +573,6 @@
 {
 	struct filter *filter;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		return;
-
 	list_for_each_entry(filter, &s->strm_flt.filters, list) {
 		if (filter->ops->http_reset)
 			filter->ops->http_reset(s, filter, msg);
@@ -612,9 +588,6 @@
 {
 	struct filter *filter;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		return;
-
 	list_for_each_entry(filter, &s->strm_flt.filters, list) {
 		if (filter->ops->http_reply)
 			filter->ops->http_reply(s, filter, status, msg);
@@ -636,10 +609,6 @@
 	struct filter *filter = NULL;
 	int            ret = len;
 
-	/* No filter, forward all data */
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		goto end;
-
 	list_for_each_entry(filter, &s->strm_flt.filters, list) {
 		if (filter->ops->http_forward_data) {
 			/*  Remove bytes that the current filter considered as
@@ -719,9 +688,6 @@
 {
 	int ret = 1;
 
-	if (LIST_ISEMPTY(&s->strm_flt.filters))
-		goto end;
-
 	RESUME_FILTER_LOOP(s, chn) {
 		if (filter->ops->channel_analyze) {
 			ret = filter->ops->channel_analyze(s, filter, chn, an_bit);
@@ -732,7 +698,6 @@
 
  check_result:
 	ret = handle_analyzer_result(s, chn, 0, ret);
- end:
 	return ret;
 }