From 15c6d7ffee04ce477c8e71392f7c71482daabfce Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 4 Aug 2009 19:09:50 +0200 Subject: made some functions static Signed-off-by: Denys Vlasenko --- src/Daemon/CrashWatcher.cpp | 16 ++++++++++------ src/Daemon/CrashWatcher.h | 1 - 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 3163d85..1dc99df 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -42,6 +42,7 @@ to_string( T x ) */ /* Is it "." or ".."? */ +/* abrtlib candidate */ static bool dot_or_dotdot(const char *filename) { if (filename[0] != '.') return false; @@ -51,6 +52,8 @@ static bool dot_or_dotdot(const char *filename) return false; } +static double GetDirSize(const std::string &pPath); + gboolean CCrashWatcher::handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointer daemon) { GIOError err; @@ -81,7 +84,8 @@ gboolean CCrashWatcher::handle_event_cb(GIOChannel *gio, GIOCondition condition, /* we want to ignore the lock files */ if (event->mask & IN_ISDIR) { - if (cc->GetDirSize(DEBUG_DUMPS_DIR)/(1024*1024.0) < cc->m_pSettings->GetMaxCrashReportsSize()){ + if (GetDirSize(DEBUG_DUMPS_DIR) / (1024*1024) < cc->m_pSettings->GetMaxCrashReportsSize()) + { //std::string sName = name; map_crash_info_t crashinfo; try @@ -402,13 +406,13 @@ void CCrashWatcher::Debug(const std::string& pMessage, const std::string& pDest) std::cout << "Debug: " + pMessage << std::endl; } -double CCrashWatcher::GetDirSize(const std::string &pPath) +static double GetDirSize(const std::string &pPath) { double size = 0; struct dirent *ep; struct stat stats; DIR *dp; - std::string dname; + dp = opendir(pPath.c_str()); if (dp != NULL) { @@ -416,7 +420,7 @@ double CCrashWatcher::GetDirSize(const std::string &pPath) { if (dot_or_dotdot(ep->d_name)) continue; - dname = pPath + "/" + ep->d_name; + std::string dname = pPath + "/" + ep->d_name; if (lstat(dname.c_str(), &stats) == 0) { if (S_ISDIR(stats.st_mode)) @@ -429,11 +433,11 @@ double CCrashWatcher::GetDirSize(const std::string &pPath) } } } - (void) closedir(dp); + closedir(dp); } else { - throw CABRTException(EXCEP_FATAL, "CCrashWatcher::GetDirSize(): Init Failed"); + throw CABRTException(EXCEP_FATAL, std::string(__func__) + ": Init Failed"); } return size; } diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index d8fc9aa..66ca71f 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -104,7 +104,6 @@ class CCrashWatcher /* finds dumps created when daemon wasn't running */ // FIXME: how to catch abrt itself without this? void FindNewDumps(const std::string& pPath); - double GetDirSize(const std::string &pPath); int m_nFd; GIOChannel* m_pGio; -- cgit