From 7900cc95e167a3fef455ab3d23021a5a8bfe11ff Mon Sep 17 00:00:00 2001 From: Rico Tiongson Date: Tue, 14 Nov 2017 00:28:12 +0800 Subject: [PATCH] [feature-systemd] Defer order of error checking for efficiency --- src/comfortable-swipe.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/comfortable-swipe.cpp b/src/comfortable-swipe.cpp index 722c582..714a914 100644 --- a/src/comfortable-swipe.cpp +++ b/src/comfortable-swipe.cpp @@ -223,11 +223,6 @@ namespace service { config["down4"].c_str() ); while (getline(cin, sentence)) { - // exit on core dump - if (sentence.find("Segmentation fault") != string::npos) - exit(EXIT_FAILURE); - if (sentence.find("Error") != string::npos) - exit(EXIT_FAILURE); auto data = sentence.data(); cmatch matches; if (regex_match(data, matches, gesture_begin)) { @@ -251,6 +246,10 @@ namespace service { swipe.udx = matches[6]; swipe.udy = matches[7]; swipe.on_update(); + } else if (sentence.find("Segmentation fault") != string::npos) { + exit(EXIT_FAILURE); + } else if (sentence.find("Error") != string::npos) { + exit(EXIT_FAILURE); } } }