aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-logcat-text.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2017-01-29 19:03:51 +0100
committerMichael Mann <mmann78@netscape.net>2017-03-04 17:25:37 +0000
commitd452a0cdba9ebb5a2f674d62fcbaa1f318454e15 (patch)
tree1142a671a9cecc5262a8cd7121644f6f0501c2ec /epan/dissectors/packet-logcat-text.c
parent3f238389eb984068f7c3500d6366f548469a13bd (diff)
Logcat-text: use GRegex optimizations
"G_REGEX_OPTIMIZE - Optimize the regular expression. If the pattern will be used many times, then it may be worth the effort to optimize it to improve the speed of matches." - Glib documentation. It is possible to capture a lot of Logcat logs or these log may flooding us. Optimizations are welcome. Change-Id: If753e795efe30b014a5fad11c8ebbcd4da3824a6 Reviewed-on: https://code.wireshark.org/review/20357 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-logcat-text.c')
-rw-r--r--epan/dissectors/packet-logcat-text.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/epan/dissectors/packet-logcat-text.c b/epan/dissectors/packet-logcat-text.c
index 970101da6e..e13614499a 100644
--- a/epan/dissectors/packet-logcat-text.c
+++ b/epan/dissectors/packet-logcat-text.c
@@ -304,14 +304,14 @@ static int dissect_logcat_text_long(tvbuff_t *tvb, packet_info *pinfo, proto_tre
static void logcat_text_init(void)
{
- special_regex = g_regex_new(SPECIAL_STRING, G_REGEX_ANCHORED, G_REGEX_MATCH_NOTEMPTY, NULL);
- brief_regex = g_regex_new(BRIEF_STRING, G_REGEX_ANCHORED, G_REGEX_MATCH_NOTEMPTY, NULL);
- tag_regex = g_regex_new(TAG_STRING, G_REGEX_ANCHORED, G_REGEX_MATCH_NOTEMPTY, NULL);
- time_regex = g_regex_new(TIME_STRING, G_REGEX_ANCHORED, G_REGEX_MATCH_NOTEMPTY, NULL);
- thread_regex = g_regex_new(THREAD_STRING, G_REGEX_ANCHORED, G_REGEX_MATCH_NOTEMPTY, NULL);
- threadtime_regex = g_regex_new(THREADTIME_STRING, G_REGEX_ANCHORED, G_REGEX_MATCH_NOTEMPTY, NULL);
- process_regex = g_regex_new(PROCESS_STRING, G_REGEX_ANCHORED, G_REGEX_MATCH_NOTEMPTY, NULL);
- long_regex = g_regex_new(LONG_STRING, G_REGEX_MULTILINE, G_REGEX_MATCH_NOTEMPTY, NULL);
+ special_regex = g_regex_new(SPECIAL_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
+ brief_regex = g_regex_new(BRIEF_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
+ tag_regex = g_regex_new(TAG_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
+ time_regex = g_regex_new(TIME_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
+ thread_regex = g_regex_new(THREAD_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
+ threadtime_regex = g_regex_new(THREADTIME_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
+ process_regex = g_regex_new(PROCESS_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
+ long_regex = g_regex_new(LONG_STRING, (GRegexCompileFlags)(G_REGEX_MULTILINE | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
}
static void logcat_text_cleanup(void)