Skip to content

Commit a468d15

Browse files
amabluea-maurice
authored andcommitted
Update parameters of MapGet to be more consistent.
PiperOrigin-RevId: 246596710
1 parent 70eec96 commit a468d15

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

database/src/desktop/core/sync_point.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ const View* SyncPoint::ViewForQuery(const QuerySpec& query_spec) const {
183183
if (QuerySpecLoadsAllData(query_spec)) {
184184
return GetCompleteView();
185185
} else {
186-
return MapGet(views_, query_spec.params);
186+
return MapGet(&views_, query_spec.params);
187187
}
188188
}
189189

database/src/desktop/core/tracked_query_manager.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
// limitations under the License.
1414

1515
#include "database/src/desktop/core/tracked_query_manager.h"
16+
1617
#include <algorithm>
1718
#include <cstdint>
1819
#include <map>
20+
1921
#include "app/src/assert.h"
2022
#include "app/src/path.h"
2123
#include "database/src/common/query_spec.h"
@@ -31,13 +33,13 @@ TrackedQueryManagerInterface::~TrackedQueryManagerInterface() {}
3133
// Returns true if the given TrackedQueryMap has a complete default query.
3234
static bool HasDefaultCompletePredicate(
3335
const TrackedQueryMap& tracked_queries) {
34-
const TrackedQuery* tracked_query = MapGet(tracked_queries, QueryParams());
36+
const TrackedQuery* tracked_query = MapGet(&tracked_queries, QueryParams());
3537
return tracked_query && tracked_query->complete;
3638
}
3739

3840
// Returns true if the given TrackedQueryMap has a complete active query.
3941
static bool HasActiveDefaultPredicate(const TrackedQueryMap& tracked_queries) {
40-
const TrackedQuery* tracked_query = MapGet(tracked_queries, QueryParams());
42+
const TrackedQuery* tracked_query = MapGet(&tracked_queries, QueryParams());
4143
return tracked_query && tracked_query->active;
4244
}
4345

@@ -87,7 +89,7 @@ const TrackedQuery* TrackedQueryManager::FindTrackedQuery(
8789
QuerySpec normalized_spec = GetNormalizedQuery(query_spec);
8890
const TrackedQueryMap* set =
8991
tracked_query_tree_.GetValueAt(normalized_spec.path);
90-
return set ? MapGet(*set, normalized_spec.params) : nullptr;
92+
return set ? MapGet(set, normalized_spec.params) : nullptr;
9193
}
9294

9395
void TrackedQueryManager::RemoveTrackedQuery(const QuerySpec& query_spec) {
@@ -166,7 +168,7 @@ bool TrackedQueryManager::IsQueryComplete(const QuerySpec& query_spec) {
166168
return false;
167169
}
168170
const TrackedQuery* tracked_query =
169-
MapGet(*tracked_queries, query_spec.params);
171+
MapGet(tracked_queries, query_spec.params);
170172
return tracked_query && tracked_query->complete;
171173
}
172174
}

database/src/desktop/core/tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class Tree {
164164
if (key.empty()) {
165165
return this;
166166
}
167-
return MapGet(children_, key);
167+
return MapGet(&children_, key);
168168
}
169169

170170
// Get a child node using the given path. If there is no node at the given

database/src/desktop/util_desktop.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ ValueType* MapGet(std::map<KeyType, ValueType>* map, const ArgType& key) {
6767
}
6868

6969
template <typename KeyType, typename ValueType, typename ArgType>
70-
const ValueType* MapGet(const std::map<KeyType, ValueType>& map,
70+
const ValueType* MapGet(const std::map<KeyType, ValueType>* map,
7171
const ArgType& key) {
72-
return MapGet(const_cast<std::map<KeyType, ValueType>*>(&map), key);
72+
return MapGet(const_cast<std::map<KeyType, ValueType>*>(map), key);
7373
}
7474

7575
// Adds all elements from `extension` to `v`.

0 commit comments

Comments
 (0)