Remove unnecessary static std::string variables (PR #1039)

This commit is contained in:
Kelvin Lee 2022-02-17 07:09:10 +11:00 committed by GitHub
parent 8cb3d4c88c
commit 7ae8907674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 18 deletions

View File

@ -153,27 +153,16 @@ void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value) {
} }
//=========================================================================== //===========================================================================
static std::string& RegGetSlotSection(UINT slot) static inline std::string RegGetSlotSection(UINT slot)
{ {
static std::string section; return (slot == SLOT_AUX)
if (slot == SLOT_AUX) ? std::string(REG_CONFIG_SLOT_AUX)
{ : (std::string(REG_CONFIG_SLOT) + (char)('0' + slot));
section = REG_CONFIG_SLOT_AUX;
}
else
{
section = REG_CONFIG_SLOT;
section += (char)('0' + slot);
}
return section;
} }
std::string& RegGetConfigSlotSection(UINT slot) std::string RegGetConfigSlotSection(UINT slot)
{ {
static std::string section; return std::string(REG_CONFIG "\\") + RegGetSlotSection(slot);
section = REG_CONFIG "\\";
section += RegGetSlotSection(slot);
return section;
} }
void RegDeleteConfigSlotSection(UINT slot) void RegDeleteConfigSlotSection(UINT slot)

View File

@ -12,6 +12,6 @@ BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD* value, DWO
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer); void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer);
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value); void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value);
std::string& RegGetConfigSlotSection(UINT slot); std::string RegGetConfigSlotSection(UINT slot);
void RegDeleteConfigSlotSection(UINT slot); void RegDeleteConfigSlotSection(UINT slot);
void RegSetConfigSlotNewCardType(UINT slot, enum SS_CARDTYPE type); void RegSetConfigSlotNewCardType(UINT slot, enum SS_CARDTYPE type);