1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks

This commit is contained in:
Rémi Verschelde
2021-05-04 14:41:06 +02:00
parent 64a63e0861
commit b5e1e05ef2
1439 changed files with 1 additions and 34187 deletions

View File

@@ -36,12 +36,10 @@
MessageQueue *MessageQueue::singleton = NULL;
MessageQueue *MessageQueue::get_singleton() {
return singleton;
}
Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error) {
_THREAD_SAFE_METHOD_
int room_needed = sizeof(Message) + sizeof(Variant) * p_argcount;
@@ -66,7 +64,6 @@ Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const V
buffer_end += sizeof(Message);
for (int i = 0; i < p_argcount; i++) {
Variant *v = memnew_placement(&buffer[buffer_end], Variant);
buffer_end += sizeof(Variant);
*v = *p_args[i];
@@ -76,7 +73,6 @@ Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const V
}
Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS;
int argc = 0;
@@ -91,7 +87,6 @@ Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, VARIANT
}
Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Variant &p_value) {
_THREAD_SAFE_METHOD_
uint8_t room_needed = sizeof(Message) + sizeof(Variant);
@@ -121,7 +116,6 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari
}
Error MessageQueue::push_notification(ObjectID p_id, int p_notification) {
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(p_notification < 0, ERR_INVALID_PARAMETER);
@@ -147,21 +141,17 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) {
}
Error MessageQueue::push_call(Object *p_object, const StringName &p_method, VARIANT_ARG_DECLARE) {
return push_call(p_object->get_instance_id(), p_method, VARIANT_ARG_PASS);
}
Error MessageQueue::push_notification(Object *p_object, int p_notification) {
return push_notification(p_object->get_instance_id(), p_notification);
}
Error MessageQueue::push_set(Object *p_object, const StringName &p_prop, const Variant &p_value) {
return push_set(p_object->get_instance_id(), p_prop, p_value);
}
void MessageQueue::statistics() {
Map<StringName, int> set_count;
Map<int, int> notify_count;
Map<StringName, int> call_count;
@@ -174,11 +164,8 @@ void MessageQueue::statistics() {
Object *target = ObjectDB::get_instance(message->instance_id);
if (target != NULL) {
switch (message->type & FLAG_MASK) {
case TYPE_CALL: {
if (!call_count.has(message->target))
call_count[message->target] = 0;
@@ -186,7 +173,6 @@ void MessageQueue::statistics() {
} break;
case TYPE_NOTIFICATION: {
if (!notify_count.has(message->notification))
notify_count[message->notification] = 0;
@@ -194,7 +180,6 @@ void MessageQueue::statistics() {
} break;
case TYPE_SET: {
if (!set_count.has(message->target))
set_count[message->target] = 0;
@@ -232,12 +217,10 @@ void MessageQueue::statistics() {
}
int MessageQueue::get_max_buffer_usage() const {
return buffer_max_used;
}
void MessageQueue::_call_function(Object *p_target, const StringName &p_func, const Variant *p_args, int p_argcount, bool p_show_error) {
const Variant **argptrs = NULL;
if (p_argcount) {
argptrs = (const Variant **)alloca(sizeof(Variant *) * p_argcount);
@@ -249,13 +232,11 @@ void MessageQueue::_call_function(Object *p_target, const StringName &p_func, co
Variant::CallError ce;
p_target->call(p_func, argptrs, p_argcount, ce);
if (p_show_error && ce.error != Variant::CallError::CALL_OK) {
ERR_PRINTS("Error calling deferred method: " + Variant::get_call_error_text(p_target, p_func, argptrs, p_argcount, ce) + ".");
}
}
void MessageQueue::flush() {
if (buffer_end > buffer_max_used) {
buffer_max_used = buffer_end;
}
@@ -269,7 +250,6 @@ void MessageQueue::flush() {
flushing = true;
while (read_pos < buffer_end) {
//lock on each iteration, so a call can re-add itself to the message queue
Message *message = (Message *)&buffer[read_pos];
@@ -286,10 +266,8 @@ void MessageQueue::flush() {
Object *target = ObjectDB::get_instance(message->instance_id);
if (target != NULL) {
switch (message->type & FLAG_MASK) {
case TYPE_CALL: {
Variant *args = (Variant *)(message + 1);
// messages don't expect a return value
@@ -298,13 +276,11 @@ void MessageQueue::flush() {
} break;
case TYPE_NOTIFICATION: {
// messages don't expect a return value
target->notification(message->notification);
} break;
case TYPE_SET: {
Variant *arg = (Variant *)(message + 1);
// messages don't expect a return value
target->set(message->target, *arg);
@@ -331,12 +307,10 @@ void MessageQueue::flush() {
}
bool MessageQueue::is_flushing() const {
return flushing;
}
MessageQueue::MessageQueue() {
ERR_FAIL_COND_MSG(singleton != NULL, "A MessageQueue singleton already exists.");
singleton = this;
flushing = false;
@@ -350,11 +324,9 @@ MessageQueue::MessageQueue() {
}
MessageQueue::~MessageQueue() {
uint32_t read_pos = 0;
while (read_pos < buffer_end) {
Message *message = (Message *)&buffer[read_pos];
Variant *args = (Variant *)(message + 1);
int argc = message->args;