From b15bc7d4436681264b32c134c71934333735fadf Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 21 Feb 2009 22:08:40 +0100 Subject: [PATCH] Logging: A minor optimization of log_apply_limits(). Exit early if all types in the set are unknown. --- ucw/log-conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ucw/log-conf.c b/ucw/log-conf.c index 8989595d..15be98e8 100644 --- a/ucw/log-conf.c +++ b/ucw/log-conf.c @@ -244,6 +244,10 @@ log_limiter(struct log_stream *ls, struct log_msg *m) static void log_apply_limits(struct log_stream *ls, struct limit_config *lim) { + uns mask = log_type_mask(&lim->types); + if (!mask) + return; + if (!ls->user_data) { ls->user_data = cf_malloc_zero(LS_NUM_TYPES * sizeof(struct token_bucket_filter *)); @@ -255,7 +259,6 @@ log_apply_limits(struct log_stream *ls, struct limit_config *lim) tbf->burst = lim->burst; tbf_init(tbf); - uns mask = log_type_mask(&lim->types); for (uns i=0; i < LS_NUM_TYPES; i++) if (mask & (1 << i)) limits[i] = tbf; -- 2.39.2