Skip to content

Commit

Permalink
Fix whitespace indent -> tab indent
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos committed Jul 26, 2023
1 parent 33faa01 commit aca2e4b
Show file tree
Hide file tree
Showing 22 changed files with 592 additions and 592 deletions.
62 changes: 31 additions & 31 deletions src/btop.cpp
Expand Up @@ -4,7 +4,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -93,9 +93,9 @@ namespace Global {
string exit_error_msg;
atomic<bool> thread_exception (false);

bool debuginit{}; // defaults to false
bool debug{}; // defaults to false
bool utf_force{}; // defaults to false
bool debuginit{}; // defaults to false
bool debug{}; // defaults to false
bool utf_force{}; // defaults to false

uint64_t start_time;

Expand All @@ -105,8 +105,8 @@ namespace Global {
atomic<bool> should_sleep (false);
atomic<bool> _runner_started (false);

bool arg_tty{}; // defaults to false
bool arg_low_color{}; // defaults to false
bool arg_tty{}; // defaults to false
bool arg_low_color{}; // defaults to false
int arg_preset = -1;
}

Expand Down Expand Up @@ -355,33 +355,33 @@ namespace Runner {
pthread_mutex_t& pt_mutex;
public:
int status;
thread_lock(pthread_mutex_t& mtx) : pt_mutex(mtx) {
pthread_mutex_init(&pt_mutex, NULL);
status = pthread_mutex_lock(&pt_mutex);
}
~thread_lock() {
if (status == 0)
pthread_mutex_unlock(&pt_mutex);
}
thread_lock(pthread_mutex_t& mtx) : pt_mutex(mtx) {
pthread_mutex_init(&pt_mutex, NULL);
status = pthread_mutex_lock(&pt_mutex);
}
~thread_lock() {
if (status == 0)
pthread_mutex_unlock(&pt_mutex);
}
};

//* Wrapper for raising priviliges when using SUID bit
class gain_priv {
int status = -1;
public:
gain_priv() {
if (Global::real_uid != Global::set_uid)
this->status = seteuid(Global::set_uid);
if (Global::real_uid != Global::set_uid)
this->status = seteuid(Global::set_uid);
}
~gain_priv() {
if (status == 0)
status = seteuid(Global::real_uid);
if (status == 0)
status = seteuid(Global::real_uid);
}
};

string output;
string empty_bg;
bool pause_output{}; // defaults to false
bool pause_output{}; // defaults to false
sigset_t mask;
pthread_t runner_id;
pthread_mutex_t mtx;
Expand Down Expand Up @@ -437,7 +437,7 @@ namespace Runner {
}

//? ------------------------------- Secondary thread: async launcher and drawing ----------------------------------
void * _runner(void *) {
void * _runner(void *) {
//? Block some signals in this thread to avoid deadlock from any signal handlers trying to stop this thread
sigemptyset(&mask);
// sigaddset(&mask, SIGINT);
Expand Down Expand Up @@ -480,8 +480,8 @@ namespace Runner {

//! DEBUG stats
if (Global::debug) {
if (debug_bg.empty() or redraw)
Runner::debug_bg = Draw::createBox(2, 2, 33, 8, "", true, "μs");
if (debug_bg.empty() or redraw)
Runner::debug_bg = Draw::createBox(2, 2, 33, 8, "", true, "μs");



Expand Down Expand Up @@ -517,7 +517,7 @@ namespace Runner {
if (Global::debug) debug_timer("cpu", draw_done);
}
catch (const std::exception& e) {
throw std::runtime_error("Cpu:: -> " + string{e.what()});
throw std::runtime_error("Cpu:: -> " + string{e.what()});
}
}

Expand All @@ -537,7 +537,7 @@ namespace Runner {
if (Global::debug) debug_timer("mem", draw_done);
}
catch (const std::exception& e) {
throw std::runtime_error("Mem:: -> " + string{e.what()});
throw std::runtime_error("Mem:: -> " + string{e.what()});
}
}

Expand All @@ -557,7 +557,7 @@ namespace Runner {
if (Global::debug) debug_timer("net", draw_done);
}
catch (const std::exception& e) {
throw std::runtime_error("Net:: -> " + string{e.what()});
throw std::runtime_error("Net:: -> " + string{e.what()});
}
}

Expand All @@ -577,12 +577,12 @@ namespace Runner {
if (Global::debug) debug_timer("proc", draw_done);
}
catch (const std::exception& e) {
throw std::runtime_error("Proc:: -> " + string{e.what()});
throw std::runtime_error("Proc:: -> " + string{e.what()});
}
}
}
catch (const std::exception& e) {
Global::exit_error_msg = "Exception in runner thread -> " + string{e.what()};
Global::exit_error_msg = "Exception in runner thread -> " + string{e.what()};
Global::thread_exception = true;
Input::interrupt = true;
stopping = true;
Expand Down Expand Up @@ -659,7 +659,7 @@ namespace Runner {
//? ------------------------------------------ Secondary thread end -----------------------------------------------

//* Runs collect and draw in a secondary thread, unlocks and locks config to update cached values
void run(const string& box, bool no_update, bool force_redraw) {
void run(const string& box, bool no_update, bool force_redraw) {
atomic_wait_for(active, true, 5000);
if (active) {
Logger::error("Stall in Runner thread, restarting!");
Expand Down Expand Up @@ -827,7 +827,7 @@ int main(int argc, char **argv) {
}
else {
string found;
bool set_failure{}; // defaults to false
bool set_failure{}; // defaults to false
for (const auto loc_env : array{"LANG", "LC_ALL"}) {
if (std::getenv(loc_env) != NULL and str_to_upper(s_replace((string)std::getenv(loc_env), "-", "")).ends_with("UTF8")) {
found = std::getenv(loc_env);
Expand Down Expand Up @@ -923,7 +923,7 @@ int main(int argc, char **argv) {
Shared::init();
}
catch (const std::exception& e) {
Global::exit_error_msg = "Exception in Shared::init() -> " + string{e.what()};
Global::exit_error_msg = "Exception in Shared::init() -> " + string{e.what()};
clean_quit(1);
}

Expand Down Expand Up @@ -1035,7 +1035,7 @@ int main(int argc, char **argv) {
}
}
catch (const std::exception& e) {
Global::exit_error_msg = "Exception in main loop -> " + string{e.what()};
Global::exit_error_msg = "Exception in main loop -> " + string{e.what()};
clean_quit(1);
}

Expand Down
10 changes: 5 additions & 5 deletions src/btop_config.cpp
Expand Up @@ -4,7 +4,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -103,7 +103,7 @@ namespace Config {

{"proc_left", "#* Show proc box on left side of screen instead of right."},

{"proc_filter_kernel", "#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop)."},
{"proc_filter_kernel", "#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop)."},

{"cpu_graph_upper", "#* Sets the CPU stat shown in upper half of the CPU graph, \"total\" is always available.\n"
"#* Select from a list of detected attributes from the options menu."},
Expand Down Expand Up @@ -234,7 +234,7 @@ namespace Config {
{"proc_cpu_graphs", true},
{"proc_info_smaps", false},
{"proc_left", false},
{"proc_filter_kernel", false},
{"proc_filter_kernel", false},
{"cpu_invert_lower", true},
{"cpu_single_graph", false},
{"cpu_bottom", false},
Expand Down Expand Up @@ -383,7 +383,7 @@ namespace Config {
return false;
}
catch (const std::exception& e) {
validError = string{e.what()};
validError = string{e.what()};
return false;
}

Expand Down Expand Up @@ -503,7 +503,7 @@ namespace Config {
boolsTmp.clear();
}
catch (const std::exception& e) {
Global::exit_error_msg = "Exception during Config::unlock() : " + string{e.what()};
Global::exit_error_msg = "Exception during Config::unlock() : " + string{e.what()};
clean_quit(1);
}

Expand Down
6 changes: 3 additions & 3 deletions src/btop_config.hpp
Expand Up @@ -4,7 +4,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -65,7 +65,7 @@ namespace Config {
bool _locked(const string& name);

//* Return bool for config key <name>
inline bool getB(const string& name) { return bools.at(name); }
inline bool getB(const string& name) { return bools.at(name); }

//* Return integer for config key <name>
inline const int& getI(const string& name) { return ints.at(name); }
Expand All @@ -81,7 +81,7 @@ namespace Config {
bool stringValid(const string& name, const string& value);

//* Set config key <name> to bool <value>
inline void set(const string& name, bool value) {
inline void set(const string& name, bool value) {
if (_locked(name)) boolsTmp.insert_or_assign(name, value);
else bools.at(name) = value;
}
Expand Down

0 comments on commit aca2e4b

Please sign in to comment.