Open sphaero opened 2 years ago
backward compat, probably?
I don't that would be an issue.
If you use zlist_autofree
char pointers are implied:
https://github.com/zeromq/czmq/blob/062aeb3bf346f8806e8d39f7da163a57ebad7543/src/zlist.c#L183-L186
Using it like that renders the zlist_remove
and zlist_exists
useless as they compare pointers by default which is of no use as the strings are duped.
So if people are using zlist_autofree
they need to set a compare function if they want any useful functionality. We can at least set it to a sane default. If people want something different they would already set so.
This issue has been automatically marked as stale because it has not had recent activity for 90 days. It will be closed if no further activity occurs within 21 days. Thank you for your contributions.
I still think this is a proper user friendly suggestion
If you are using
zlist_autofree
(usually for storing strings) is there any situation imaginable where you don't want to usestrcmp
as a comparator function?As
zlist_autofree
duplicates strings you can't usezlist_exists
orzlist_remove
if you don't set a comparator.So why not set the comparator automatically?
zlist_comparefn (mylist, (zlist_compare_fn *) strcmp);