Commit Graph

21 Commits

Author SHA1 Message Date
Takeshi MIZUTA
37a6e7a5f1 Add the processing which remove notifier at skiplist_destroy function 2013-01-15 01:57:29 +09:00
Takeshi MIZUTA
96e504f305 Unify the list processing with qb_list function 2013-01-09 02:04:20 +09:00
Angus Salkeld
205336980c use random() not rand()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
2da98acd42 MAP: add a notifier purely to allow the user to free memory.
At the moment if you have multiple notifiers it becomes impossible
to figure out when it is safe to free the values.

This new callback can only be added once and is called
once, making it better suited to freeing memory. It is
also called after the deleted and replaced notifiers.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-14 00:26:01 +11:00
Angus Salkeld
e01b79883a map: enforce uniqueness of the notifiers based on (func,key,event,userdata)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 13:25:56 +11:00
Angus Salkeld
2d92af61c5 map: add qb_map_notify_del_2() which includes the userdata.
This allows you to match on the same fields that you provided
in the add. Now including the userdata.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:28:14 +11:00
Angus Salkeld
3c01f7bdb2 skiplist: add the inserted notification
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:28:01 +11:00
Angus Salkeld
fbdfd34f59 skiplist: implement skiplist_notify_del()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:19:11 +11:00
Angus Salkeld
ca4fe98136 Lindent formatting changes.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:49:14 +11:00
Angus Salkeld
9959615598 MAP: Fix trie_new_node() and make skiplist_node_new() more consistent.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:39:13 +11:00
miz-take
fcd96fc8e0 Improve the error handling esp. after failed malloc's
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 09:50:38 +11:00
Angus Salkeld
a44df811a0 skiplist: destroy the list header last.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-24 09:35:13 +11:00
Angus Salkeld
dc3a061e98 MAP: pass user_data to the callback correctly
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-16 13:31:31 +10:00
Angus Salkeld
d6e352fda5 MAP: add a more generic notification system
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-15 21:14:49 +10:00
Angus Salkeld
4780308fea MAP: add prefix iteration for the trie
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 20:54:39 +10:00
Angus Salkeld
34e5a469aa skiplist: fix order of deref
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:09:20 +10:00
Angus Salkeld
94df31cb44 skiplist: use ++ and -- operators
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:09:20 +10:00
Angus Salkeld
86f004d1ec map: add iterator that does't use a callback
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 12:05:15 +10:00
Angus Salkeld
4b594b522d MAP: change the keys from void* to char*
I think this is the most common usage and greatly
simplifies the api.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 09:47:49 +10:00
Angus Salkeld
8c98054bfa Fix "./check dist"
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-26 09:37:25 +10:00
Angus Salkeld
94767b18b8 Initial map using either a skiplist or a hashtable
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 14:11:43 +10:00