You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ((elem)->previous != NULL) (elem)->previous->next = (elem);\
Hi!
Would like to suggest a change. (bugfix)
After the indicated line above, there should be the line:
(place) = (elem)\
This allows consecutive use of sglib_type_add_before(dllist_first), in the corner case where the dllist_first is NULL to begin with.
Current solution results in keeping the dllist_first pointer value the same as first call and place all new entries behind this first one which is continuously is moving further away from the 'front'.
Hence, new entries are placed at length-2 position!
This change fixed it. I can also push the change for review, if you like.
I am only working with the doubly ended linked list.
Best regards
The text was updated successfully, but these errors were encountered:
First, this repository is not maintained, either by me or @stefanct. Second, I sent my patches to Marian Vittek, and he isn't around anymore. I ended up doing my own implementation (only rbtree, queue and stack; I don't see the point of linked lists).
If I were the maintainer of sglib, I would ask you to extend the tests for this edge cases, to demonstrate how the patch improves things. So I can step through and convince myself, that there are no negative side-effects.
I like sglib very much, that's the reason I implemented parts of it from scratch, in order to learn how to implement generic C libraries. However, I won't maintain sglib. That is the sad truth.
sglib/sglib.h
Line 554 in 1d17ed7
Hi!
Would like to suggest a change. (bugfix)
After the indicated line above, there should be the line:
(place) = (elem)\
This allows consecutive use of sglib_type_add_before(dllist_first), in the corner case where the dllist_first is NULL to begin with.
Current solution results in keeping the dllist_first pointer value the same as first call and place all new entries behind this first one which is continuously is moving further away from the 'front'.
Hence, new entries are placed at length-2 position!
This change fixed it. I can also push the change for review, if you like.
I am only working with the doubly ended linked list.
Best regards
The text was updated successfully, but these errors were encountered: