/*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
char *
CacheManager::PasswdGet(Mgr::ActionPasswordList * a, const char *action)
{
- wordlist *w;
-
- while (a != NULL) {
- for (w = a->actions; w != NULL; w = w->next) {
- if (0 == strcmp(w->key, action))
+ while (a) {
+ for (auto &w : a->actions) {
+ if (w.cmp(action) == 0)
return a->passwd;
- if (0 == strcmp(w->key, "all"))
+ static const SBuf allAction("all");
+ if (w == allAction)
return a->passwd;
}
return NULL;
}
-CacheManager* CacheManager::instance=0;
-
-/**
- \ingroup CacheManagerAPI
- * Singleton accessor method.
- */
CacheManager*
CacheManager::GetInstance()
{
- if (instance == 0) {
- debugs(16, 6, "CacheManager::GetInstance: starting cachemanager up");
+ static CacheManager *instance = nullptr;
+ if (!instance) {
+ debugs(16, 6, "starting cachemanager up");
instance = new CacheManager;
Mgr::RegisterBasics();
}