mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 00:49:08 +00:00
chore(event): clean up SEvtDispatch implementation
This commit is contained in:
parent
29d99a2cbc
commit
efc52d4831
1 changed files with 9 additions and 25 deletions
|
|
@ -145,21 +145,12 @@ int32_t STORMAPI SEvtDispatch(uint32_t type, uint32_t subtype, uint32_t id, void
|
||||||
do {
|
do {
|
||||||
s_critsect.Enter();
|
s_critsect.Enter();
|
||||||
|
|
||||||
int32_t breakcmd = 0;
|
bool breakcmd = false;
|
||||||
BREAKCMD* curr = s_breakcmdlist.Head();
|
for (BREAKCMD* curr = s_breakcmdlist.Head(); reinterpret_cast<intptr_t>(curr) > 0; curr = s_breakcmdlist.RawNext(curr)) {
|
||||||
int32_t iterate_delete = 0;
|
|
||||||
while (reinterpret_cast<intptr_t>(curr) > 0) {
|
|
||||||
if (curr->data == data) {
|
if (curr->data == data) {
|
||||||
breakcmd = 1;
|
breakcmd = true;
|
||||||
iterate_delete = -12;
|
s_breakcmdlist.DeleteNode(curr);
|
||||||
}
|
break;
|
||||||
|
|
||||||
if (iterate_delete) {
|
|
||||||
curr = iterate_delete <= 0 ? nullptr : s_breakcmdlist.DeleteNode(curr);
|
|
||||||
iterate_delete = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
curr = s_breakcmdlist.RawNext(curr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (breakcmd) {
|
if (breakcmd) {
|
||||||
|
|
@ -208,20 +199,13 @@ int32_t STORMAPI SEvtDispatch(uint32_t type, uint32_t subtype, uint32_t id, void
|
||||||
|
|
||||||
if (s_breakcmdlist.Head()) {
|
if (s_breakcmdlist.Head()) {
|
||||||
s_critsect.Enter();
|
s_critsect.Enter();
|
||||||
|
|
||||||
BREAKCMD* ptr = s_breakcmdlist.Head();
|
|
||||||
int32_t iterate_delete = 0;
|
|
||||||
while (reinterpret_cast<intptr_t>(ptr) > 0) {
|
|
||||||
if (ptr->data == data) {
|
|
||||||
iterate_delete = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iterate_delete) {
|
for (BREAKCMD* curr = s_breakcmdlist.Head(); reinterpret_cast<intptr_t>(curr) > 0;) {
|
||||||
ptr = iterate_delete <= 0 ? nullptr : s_breakcmdlist.DeleteNode(ptr);
|
if (curr->data == data) {
|
||||||
iterate_delete = 0;
|
curr = s_breakcmdlist.DeleteNode(curr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ptr = s_breakcmdlist.RawNext(ptr);
|
curr = s_breakcmdlist.RawNext(curr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue