[feature-systemd] Defer order of error checking for efficiency

This commit is contained in:
Rico Tiongson 2017-11-14 00:28:12 +08:00
parent 08e08a0f90
commit 7900cc95e1

View File

@ -223,11 +223,6 @@ namespace service {
config["down4"].c_str() config["down4"].c_str()
); );
while (getline(cin, sentence)) { 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(); auto data = sentence.data();
cmatch matches; cmatch matches;
if (regex_match(data, matches, gesture_begin)) { if (regex_match(data, matches, gesture_begin)) {
@ -251,6 +246,10 @@ namespace service {
swipe.udx = matches[6]; swipe.udx = matches[6];
swipe.udy = matches[7]; swipe.udy = matches[7];
swipe.on_update(); swipe.on_update();
} else if (sentence.find("Segmentation fault") != string::npos) {
exit(EXIT_FAILURE);
} else if (sentence.find("Error") != string::npos) {
exit(EXIT_FAILURE);
} }
} }
} }