mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 15:01:01 +00:00
commit
5a2ca8e72e
2
list.c
2
list.c
|
@ -54,6 +54,8 @@ bool list_remove(struct list *list, void *data)
|
||||||
if (cur->data == data) {
|
if (cur->data == data) {
|
||||||
if (cur == list->head) {
|
if (cur == list->head) {
|
||||||
list->head = next;
|
list->head = next;
|
||||||
|
} else {
|
||||||
|
prev->next = next;
|
||||||
}
|
}
|
||||||
if (cur == list->tail) {
|
if (cur == list->tail) {
|
||||||
list->tail = prev;
|
list->tail = prev;
|
||||||
|
|
18
uc.c
18
uc.c
|
@ -1029,15 +1029,19 @@ uc_err uc_hook_add(uc_engine *uc, uc_hook *hh, int type, void *callback,
|
||||||
UNICORN_EXPORT
|
UNICORN_EXPORT
|
||||||
uc_err uc_hook_del(uc_engine *uc, uc_hook hh)
|
uc_err uc_hook_del(uc_engine *uc, uc_hook hh)
|
||||||
{
|
{
|
||||||
int i;
|
int i = 0;
|
||||||
struct hook *hook;
|
struct hook *hook = (struct hook *)hh;
|
||||||
for (i = 0; i < UC_HOOK_MAX; i++) {
|
int type = hook->type;
|
||||||
if (list_remove(&uc->hook[i], (void *)hh)) {
|
|
||||||
hook = (struct hook *)hh;
|
while ((type >> i) > 0 && i < UC_HOOK_MAX) {
|
||||||
if (--hook->refs == 0) {
|
if ((type >> i) & 1) {
|
||||||
free(hook);
|
if (list_remove(&uc->hook[i], (void *)hh)) {
|
||||||
|
if (--hook->refs == 0) {
|
||||||
|
free(hook);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue