X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/5ff8211bdcd5f110621c0ff01fa0854b5e6d9762..db323584230f6d5b4a6e16574fd0baadc9d465e5:/projects/stargazer/services_impl.cpp?ds=sidebyside diff --git a/projects/stargazer/services_impl.cpp b/projects/stargazer/services_impl.cpp index 85b0f4e5..aebb98fb 100644 --- a/projects/stargazer/services_impl.cpp +++ b/projects/stargazer/services_impl.cpp @@ -43,12 +43,12 @@ Read(); //----------------------------------------------------------------------------- int SERVICES_IMPL::Add(const SERVICE_CONF & service, const ADMIN * admin) { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); const PRIV * priv = admin->GetPriv(); if (!priv->serviceChg) { - string s = admin->GetLogStr() + " Add service \'" + service.name + "\'. Access denied."; + std::string s = admin->GetLogStr() + " Add service \'" + service.name + "\'. Access denied."; strError = "Access denied."; WriteServLog(s.c_str()); return -1; @@ -79,14 +79,14 @@ WriteServLog("%s %s", admin->GetLogStr().c_str(), strError.c_str()); return -1; } //----------------------------------------------------------------------------- -int SERVICES_IMPL::Del(const string & name, const ADMIN * admin) +int SERVICES_IMPL::Del(const std::string & name, const ADMIN * admin) { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); const PRIV * priv = admin->GetPriv(); if (!priv->serviceChg) { - string s = admin->GetLogStr() + " Delete service \'" + name + "\'. Access denied."; + std::string s = admin->GetLogStr() + " Delete service \'" + name + "\'. Access denied."; strError = "Access denied."; WriteServLog(s.c_str()); return -1; @@ -101,7 +101,7 @@ if (si == data.end()) return -1; } -map::iterator csi; +std::map::iterator csi; csi = searchDescriptors.begin(); while (csi != searchDescriptors.end()) { @@ -125,12 +125,12 @@ return 0; //----------------------------------------------------------------------------- int SERVICES_IMPL::Change(const SERVICE_CONF & service, const ADMIN * admin) { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); const PRIV * priv = admin->GetPriv(); if (!priv->serviceChg) { - string s = admin->GetLogStr() + " Change service \'" + service.name + "\'. Access denied."; + std::string s = admin->GetLogStr() + " Change service \'" + service.name + "\'. Access denied."; strError = "Access denied."; WriteServLog(s.c_str()); return -1; @@ -161,8 +161,8 @@ return 0; //----------------------------------------------------------------------------- bool SERVICES_IMPL::Read() { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); -vector servicesList; +STG_LOCKER lock(&mutex); +std::vector servicesList; if (store->GetServicesList(&servicesList) < 0) { WriteServLog(store->GetStrError().c_str()); @@ -184,11 +184,11 @@ for (size_t i = 0; i < servicesList.size(); i++) return false; } //----------------------------------------------------------------------------- -bool SERVICES_IMPL::Find(const string & name, SERVICE_CONF * service) +bool SERVICES_IMPL::Find(const std::string & name, SERVICE_CONF * service) { assert(service != NULL && "Pointer to service is not null"); -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (data.empty()) return false; @@ -203,9 +203,9 @@ if (si != data.end()) return true; } //----------------------------------------------------------------------------- -bool SERVICES_IMPL::Exists(const string & name) const +bool SERVICES_IMPL::Exists(const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (data.empty()) { printfd(__FILE__, "no admin in system!\n"); @@ -222,7 +222,7 @@ return false; //----------------------------------------------------------------------------- int SERVICES_IMPL::OpenSearch() const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); handle++; searchDescriptors[handle] = data.begin(); return handle; @@ -230,7 +230,7 @@ return handle; //----------------------------------------------------------------------------- int SERVICES_IMPL::SearchNext(int h, SERVICE_CONF * service) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (searchDescriptors.find(h) == searchDescriptors.end()) { WriteServLog("SERVICES. Incorrect search handle."); @@ -247,7 +247,7 @@ return 0; //----------------------------------------------------------------------------- int SERVICES_IMPL::CloseSearch(int h) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (searchDescriptors.find(h) != searchDescriptors.end()) { searchDescriptors.erase(searchDescriptors.find(h));