-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOUBLE DELETE with "DL_DELETE2" create BROKEN list: #270
Comments
patch for DL_DELETE2
patch for CDL_DELETE2
|
IIUC, you're asking to add this to the macro:
But that merely modifies the prev and next pointers of the element that you have just removed from the list! Since that element is no longer in the list, its prev and next pointers are irrelevant. Resetting them to NULL merely wastes CPU cycles. Worse, there are actually use-cases where not resetting the prev and next pointers is part of the algorithm. For example: Knuth's Dancing Links. If you're worried about catching bugs in your own code (as opposed to bugs in uthash), then you could always add that line to your own code:
Alternatively, you could define your own "delete-and-reset-pointers" macro:
|
ok, The assert from above only works if |
Hi, I investigate an BUG in my code end up in an INFINITE loop of of a "DL".
The main reason was an DOUBLE DELETE of the SAME object from the list:
insert
before
after
first delete
before
after
second delete
before
after
The text was updated successfully, but these errors were encountered: