internal: refactor to use empty() (#10599)

This commit is contained in:
Kamikadze 2025-05-31 23:49:50 +05:00 committed by GitHub
parent 4078e1d17c
commit 69c2b2926e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 57 additions and 57 deletions

View file

@ -164,7 +164,7 @@ CKeybindManager::CKeybindManager() {
m_repeatKeyTimer = makeShared<CEventLoopTimer>(
std::nullopt,
[this](SP<CEventLoopTimer> self, void* data) {
if (m_activeKeybinds.size() == 0 || g_pSeatManager->m_keyboard.expired())
if (m_activeKeybinds.empty() || g_pSeatManager->m_keyboard.expired())
return;
const auto PACTIVEKEEB = g_pSeatManager->m_keyboard.lock();
@ -288,7 +288,7 @@ void CKeybindManager::updateXKBTranslationState() {
xkb_rule_names rules = {.rules = RULES.c_str(), .model = MODEL.c_str(), .layout = LAYOUT.c_str(), .variant = VARIANT.c_str(), .options = OPTIONS.c_str()};
const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
FILE* const KEYMAPFILE = FILEPATH == "" ? nullptr : fopen(absolutePath(FILEPATH, g_pConfigManager->m_configCurrentPath).c_str(), "r");
FILE* const KEYMAPFILE = FILEPATH.empty() ? nullptr : fopen(absolutePath(FILEPATH, g_pConfigManager->m_configCurrentPath).c_str(), "r");
auto PKEYMAP = KEYMAPFILE ? xkb_keymap_new_from_file(PCONTEXT, KEYMAPFILE, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS) :
xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
@ -630,7 +630,7 @@ eMultiKeyCase CKeybindManager::mkKeysymSetMatches(const std::set<xkb_keysym_t> k
if (boundKeysNotPressed.empty() && pressedKeysNotBound.empty())
return MK_FULL_MATCH;
if (boundKeysNotPressed.size() && pressedKeysNotBound.empty())
if (!boundKeysNotPressed.empty() && pressedKeysNotBound.empty())
return MK_PARTIAL_MATCH;
return MK_NO_MATCH;
@ -2398,7 +2398,7 @@ SDispatchResult CKeybindManager::toggleSwallow(std::string args) {
}
SDispatchResult CKeybindManager::setSubmap(std::string submap) {
if (submap == "reset" || submap == "") {
if (submap == "reset" || submap.empty()) {
m_currentSelectedSubmap = "";
Debug::log(LOG, "Reset active submap to the default one.");
g_pEventManager->postEvent(SHyprIPCEvent{"submap", ""});
@ -2576,7 +2576,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
//if regexp is not empty, send shortcut to current window
//else, dont change focus
if (regexp != "") {
if (!regexp.empty()) {
PWINDOW = g_pCompositor->getWindowByRegex(regexp);
if (!PWINDOW) {