Blame 0260-xorg-rewrite-skip_pfx-function-to-work-with-journal-.patch

69165ba
From e001949d7ef821d7934e9d1756856ea8630968e5 Mon Sep 17 00:00:00 2001
69165ba
From: Matej Habrnal <mhabrnal@redhat.com>
69165ba
Date: Mon, 23 Jan 2017 11:36:16 +0100
69165ba
Subject: [PATCH] xorg: rewrite skip_pfx() function to work with journal msgs
69165ba
69165ba
skip_pfx() removes substrings which starts with '[' and end with ']'.
69165ba
Xorg journal messages which we can remove can also start with "(EE)" and end
69165ba
with ']'.
69165ba
69165ba
Related to #1328264
69165ba
69165ba
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
69165ba
---
69165ba
 src/plugins/abrt-dump-xorg.c | 26 +++++++++++++++++---------
69165ba
 1 file changed, 17 insertions(+), 9 deletions(-)
69165ba
69165ba
diff --git a/src/plugins/abrt-dump-xorg.c b/src/plugins/abrt-dump-xorg.c
69165ba
index 434dc76..14fd561 100644
69165ba
--- a/src/plugins/abrt-dump-xorg.c
69165ba
+++ b/src/plugins/abrt-dump-xorg.c
69165ba
@@ -44,16 +44,24 @@ static unsigned g_bt_count = 0;
69165ba
 static unsigned g_opts;
69165ba
 static const char *debug_dumps_dir = ".";
69165ba
 
69165ba
-static char *skip_pfx(char *p)
69165ba
+static char *skip_pfx(char *str)
69165ba
 {
69165ba
-    if (p[0] != '[')
69165ba
-        return p;
69165ba
-    char *q = strchr(p, ']');
69165ba
-    if (!q)
69165ba
-        return p;
69165ba
-    if (q[1] == ' ')
69165ba
-        return q + 2;
69165ba
-    return p;
69165ba
+    if (str[0] == '[')
69165ba
+    {
69165ba
+        char *q = strchr(str, ']');
69165ba
+        if (q)
69165ba
+            str = q + 1;
69165ba
+    }
69165ba
+
69165ba
+    if (str[0] == ' ')
69165ba
+        ++str;
69165ba
+
69165ba
+    /* if there is (EE), ignore it */
69165ba
+    if (strncmp(str, "(EE)", 4) == 0)
69165ba
+        /* if ' ' follows (EE), ignore it too */
69165ba
+        return str + (4 + (str[4] == ' '));
69165ba
+
69165ba
+    return str;
69165ba
 }
69165ba
 
69165ba
 static char *list2lines(GList *list)
69165ba
-- 
69165ba
1.8.3.1
69165ba