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

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