Use helper function empty_string() instead of manual checks

For code consistency, substitute boolean expressions:
 s && *s     -> !empty_string(s)
 s && s[0]   -> !empty_string(s)
 !s || !*s   ->  empty_string(s)
 !s || !s[0] ->  empty_string(s)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-01-07 15:42:28 +01:00 committed by Lubomir I. Ivanov
parent e85ecdd925
commit 6a07ccbad2
8 changed files with 11 additions and 11 deletions

View file

@ -102,7 +102,7 @@ extern "C" void showErrorFromC()
void MainWindow::showErrors()
{
const char *error = get_error_string();
if (error && error[0])
if (!empty_string(error))
getNotificationWidget()->showNotification(error, KMessageWidget::Error);
}
@ -1766,7 +1766,7 @@ void MainWindow::setAutomaticTitle()
void MainWindow::setTitle()
{
if (!existing_filename || !existing_filename[0]) {
if (empty_string(existing_filename)) {
setWindowTitle("Subsurface");
return;
}