You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
This commit is contained in:
@@ -91,7 +91,6 @@ static void _setup_clock() {
|
||||
#endif
|
||||
|
||||
void OS_Unix::debug_break() {
|
||||
|
||||
assert(false);
|
||||
};
|
||||
|
||||
@@ -104,7 +103,6 @@ static void handle_interrupt(int sig) {
|
||||
}
|
||||
|
||||
void OS_Unix::initialize_debugging() {
|
||||
|
||||
if (EngineDebugger::is_active()) {
|
||||
struct sigaction action;
|
||||
memset(&action, 0, sizeof(action));
|
||||
@@ -114,12 +112,10 @@ void OS_Unix::initialize_debugging() {
|
||||
}
|
||||
|
||||
int OS_Unix::unix_initialize_audio(int p_audio_driver) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OS_Unix::initialize_core() {
|
||||
|
||||
#ifdef NO_THREADS
|
||||
ThreadDummy::make_default();
|
||||
RWLockDummy::make_default();
|
||||
@@ -144,17 +140,14 @@ void OS_Unix::initialize_core() {
|
||||
}
|
||||
|
||||
void OS_Unix::finalize_core() {
|
||||
|
||||
NetSocketPosix::cleanup();
|
||||
}
|
||||
|
||||
void OS_Unix::alert(const String &p_alert, const String &p_title) {
|
||||
|
||||
fprintf(stderr, "ERROR: %s\n", p_alert.utf8().get_data());
|
||||
}
|
||||
|
||||
String OS_Unix::get_stdin_string(bool p_block) {
|
||||
|
||||
if (p_block) {
|
||||
char buff[1024];
|
||||
String ret = stdin_buf + fgets(buff, 1024, stdin);
|
||||
@@ -166,12 +159,10 @@ String OS_Unix::get_stdin_string(bool p_block) {
|
||||
}
|
||||
|
||||
String OS_Unix::get_name() const {
|
||||
|
||||
return "Unix";
|
||||
}
|
||||
|
||||
uint64_t OS_Unix::get_unix_time() const {
|
||||
|
||||
return time(nullptr);
|
||||
};
|
||||
|
||||
@@ -188,7 +179,6 @@ uint64_t OS_Unix::get_system_time_msecs() const {
|
||||
}
|
||||
|
||||
OS::Date OS_Unix::get_date(bool utc) const {
|
||||
|
||||
time_t t = time(nullptr);
|
||||
struct tm *lt;
|
||||
if (utc)
|
||||
@@ -250,13 +240,11 @@ OS::TimeZoneInfo OS_Unix::get_time_zone_info() const {
|
||||
}
|
||||
|
||||
void OS_Unix::delay_usec(uint32_t p_usec) const {
|
||||
|
||||
struct timespec rem = { static_cast<time_t>(p_usec / 1000000), (static_cast<long>(p_usec) % 1000000) * 1000 };
|
||||
while (nanosleep(&rem, &rem) == EINTR) {
|
||||
}
|
||||
}
|
||||
uint64_t OS_Unix::get_ticks_usec() const {
|
||||
|
||||
#if defined(__APPLE__)
|
||||
uint64_t longtime = mach_absolute_time() * _clock_scale;
|
||||
#else
|
||||
@@ -272,19 +260,16 @@ uint64_t OS_Unix::get_ticks_usec() const {
|
||||
}
|
||||
|
||||
Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// Don't compile this code at all to avoid undefined references.
|
||||
// Actual virtual call goes to OS_JavaScript.
|
||||
ERR_FAIL_V(ERR_BUG);
|
||||
#else
|
||||
if (p_blocking && r_pipe) {
|
||||
|
||||
String argss;
|
||||
argss = "\"" + p_path + "\"";
|
||||
|
||||
for (int i = 0; i < p_arguments.size(); i++) {
|
||||
|
||||
argss += String(" \"") + p_arguments[i] + "\"";
|
||||
}
|
||||
|
||||
@@ -300,7 +285,6 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
|
||||
char buf[65535];
|
||||
|
||||
while (fgets(buf, 65535, f)) {
|
||||
|
||||
if (p_pipe_mutex) {
|
||||
p_pipe_mutex->lock();
|
||||
}
|
||||
@@ -345,14 +329,12 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
|
||||
}
|
||||
|
||||
if (p_blocking) {
|
||||
|
||||
int status;
|
||||
waitpid(pid, &status, 0);
|
||||
if (r_exitcode)
|
||||
*r_exitcode = WEXITSTATUS(status);
|
||||
|
||||
} else {
|
||||
|
||||
if (r_child_id)
|
||||
*r_child_id = pid;
|
||||
}
|
||||
@@ -362,7 +344,6 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
|
||||
}
|
||||
|
||||
Error OS_Unix::kill(const ProcessID &p_pid) {
|
||||
|
||||
int ret = ::kill(p_pid, SIGKILL);
|
||||
if (!ret) {
|
||||
//avoid zombie process
|
||||
@@ -373,17 +354,14 @@ Error OS_Unix::kill(const ProcessID &p_pid) {
|
||||
}
|
||||
|
||||
int OS_Unix::get_process_id() const {
|
||||
|
||||
return getpid();
|
||||
};
|
||||
|
||||
bool OS_Unix::has_environment(const String &p_var) const {
|
||||
|
||||
return getenv(p_var.utf8().get_data()) != nullptr;
|
||||
}
|
||||
|
||||
String OS_Unix::get_locale() const {
|
||||
|
||||
if (!has_environment("LANG"))
|
||||
return "en";
|
||||
|
||||
@@ -395,7 +373,6 @@ String OS_Unix::get_locale() const {
|
||||
}
|
||||
|
||||
Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
|
||||
|
||||
String path = p_path;
|
||||
|
||||
if (FileAccess::exists(path) && path.is_rel_path()) {
|
||||
@@ -442,7 +419,6 @@ Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const S
|
||||
}
|
||||
|
||||
Error OS_Unix::set_cwd(const String &p_cwd) {
|
||||
|
||||
if (chdir(p_cwd.utf8().get_data()) != 0)
|
||||
return ERR_CANT_OPEN;
|
||||
|
||||
@@ -450,24 +426,20 @@ Error OS_Unix::set_cwd(const String &p_cwd) {
|
||||
}
|
||||
|
||||
String OS_Unix::get_environment(const String &p_var) const {
|
||||
|
||||
if (getenv(p_var.utf8().get_data()))
|
||||
return getenv(p_var.utf8().get_data());
|
||||
return "";
|
||||
}
|
||||
|
||||
bool OS_Unix::set_environment(const String &p_var, const String &p_value) const {
|
||||
|
||||
return setenv(p_var.utf8().get_data(), p_value.utf8().get_data(), /* overwrite: */ true) == 0;
|
||||
}
|
||||
|
||||
int OS_Unix::get_processor_count() const {
|
||||
|
||||
return sysconf(_SC_NPROCESSORS_CONF);
|
||||
}
|
||||
|
||||
String OS_Unix::get_user_data_dir() const {
|
||||
|
||||
String appname = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/name"));
|
||||
if (appname != "") {
|
||||
bool use_custom_dir = ProjectSettings::get_singleton()->get("application/config/use_custom_user_dir");
|
||||
@@ -486,7 +458,6 @@ String OS_Unix::get_user_data_dir() const {
|
||||
}
|
||||
|
||||
String OS_Unix::get_executable_path() const {
|
||||
|
||||
#ifdef __linux__
|
||||
//fix for running from a symlink
|
||||
char buf[256];
|
||||
|
||||
Reference in New Issue
Block a user