Cleanup: remove redundant "contains" checks before erasing items

This commit is contained in:
Campbell Barton 2023-12-10 17:14:46 +11:00
parent 52a7555a84
commit 64c4b3428f
2 changed files with 8 additions and 12 deletions

@ -259,9 +259,8 @@ bool GHOST_XrAction::createBinding(XrInstance instance,
void GHOST_XrAction::destroyBinding(const char *profile_path)
{
if (m_profiles.find(profile_path) != m_profiles.end()) {
m_profiles.erase(profile_path);
}
/* It's possible nothing is removed. */
m_profiles.erase(profile_path);
}
void GHOST_XrAction::updateState(XrSession session,
@ -492,9 +491,8 @@ bool GHOST_XrActionSet::createAction(XrInstance instance, const GHOST_XrActionIn
void GHOST_XrActionSet::destroyAction(const char *action_name)
{
if (m_actions.find(action_name) != m_actions.end()) {
m_actions.erase(action_name);
}
/* It's possible nothing is removed. */
m_actions.erase(action_name);
}
GHOST_XrAction *GHOST_XrActionSet::findAction(const char *action_name)

@ -646,9 +646,8 @@ bool GHOST_XrSession::createActionSet(const GHOST_XrActionSetInfo &info)
void GHOST_XrSession::destroyActionSet(const char *action_set_name)
{
std::map<std::string, GHOST_XrActionSet> &action_sets = m_oxr->action_sets;
if (action_sets.find(action_set_name) != action_sets.end()) {
action_sets.erase(action_set_name);
}
/* It's possible nothing is removed. */
action_sets.erase(action_set_name);
}
bool GHOST_XrSession::createActions(const char *action_set_name,
@ -948,9 +947,8 @@ bool GHOST_XrSession::loadControllerModel(const char *subaction_path)
void GHOST_XrSession::unloadControllerModel(const char *subaction_path)
{
std::map<std::string, GHOST_XrControllerModel> &controller_models = m_oxr->controller_models;
if (controller_models.find(subaction_path) != controller_models.end()) {
controller_models.erase(subaction_path);
}
/* It's possible nothing is removed. */
controller_models.erase(subaction_path);
}
bool GHOST_XrSession::updateControllerModelComponents(const char *subaction_path)