mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor: style issue
This commit is contained in:
@ -16,7 +16,7 @@ waybar::modules::Battery::Battery(Json::Value config)
|
||||
if (batteries_.empty()) {
|
||||
throw std::runtime_error("No batteries.");
|
||||
}
|
||||
auto fd = inotify_init();
|
||||
auto fd = inotify_init1(IN_CLOEXEC);
|
||||
if (fd == -1) {
|
||||
throw std::runtime_error("Unable to listen batteries.");
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ auto waybar::modules::Cpu::update() -> void
|
||||
{
|
||||
struct sysinfo info = {0};
|
||||
if (sysinfo(&info) == 0) {
|
||||
float f_load = 1.f / (1U << SI_LOAD_SHIFT);
|
||||
float f_load = 1.f / (1u << SI_LOAD_SHIFT);
|
||||
uint16_t load = info.loads[0] * f_load * 100 / get_nprocs();
|
||||
auto format = config_["format"] ? config_["format"].asString() : "{}%";
|
||||
label_.set_text(fmt::format(format, load));
|
||||
|
@ -234,9 +234,9 @@ int waybar::modules::Network::getExternalInterface()
|
||||
} while (true);
|
||||
|
||||
out:
|
||||
if (req)
|
||||
if (req != nullptr)
|
||||
free(req);
|
||||
if (resp)
|
||||
if (resp != nullptr)
|
||||
free(resp);
|
||||
return ifidx;
|
||||
}
|
||||
|
Reference in New Issue
Block a user