From 1978c49bea5b439d993067c055cec47e70db8fd6 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Sat, 7 Oct 2023 22:33:50 +0200 Subject: minor refactoring --- src/maildir-delete.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/maildir-delete.cc') diff --git a/src/maildir-delete.cc b/src/maildir-delete.cc index b0abb2a..356128b 100644 --- a/src/maildir-delete.cc +++ b/src/maildir-delete.cc @@ -1,9 +1,10 @@ -/** -------------------------------------------------------------------- +/** * @file maildir-delete.cc * @brief Implementation of the Maildir class. * @author Andreas Aardal Hanssen * @date 2002-2005 - * ----------------------------------------------------------------- **/ + */ + #include "maildir.h" #include @@ -14,18 +15,18 @@ #include #include -using namespace ::std; using namespace Binc; +using std::string; namespace { bool recursiveDelete(const string &path) { DIR *mydir = opendir(path.c_str()); - if (mydir == 0) return false; + if (mydir == nullptr) return false; struct dirent *mydirent; - while ((mydirent = readdir(mydir)) != 0) { + while ((mydirent = readdir(mydir)) != nullptr) { string d = mydirent->d_name; if (d == "." || d == "..") continue; @@ -46,11 +47,9 @@ namespace { closedir(mydir); return false; } - } else { - if (unlink(f.c_str()) != 0 && errno != ENOENT) { - closedir(mydir); - return false; - } + } else if (unlink(f.c_str()) != 0 && errno != ENOENT) { + closedir(mydir); + return false; } } @@ -59,7 +58,6 @@ namespace { } } -//------------------------------------------------------------------------ bool Binc::Maildir::deleteMailbox(const string &s_in) { if (s_in == ".") { -- cgit v1.2.3