aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-12-10 11:57:30 -0500
committerNick Mathewson <nickm@torproject.org>2009-12-12 19:06:38 -0500
commitc210db0d41f4a47496e12c0af829f8ae0a5c2cd2 (patch)
treec0000252ac688c6e9525206b4aa906088f4b902d /src/common/container.h
parentd086c9a7f73ce5b9b7cf4add07fa7d071b829081 (diff)
downloadtor-c210db0d41f4a47496e12c0af829f8ae0a5c2cd2.tar
tor-c210db0d41f4a47496e12c0af829f8ae0a5c2cd2.tar.gz
Enhance pqueue so we can remove items from the middle.
This changes the pqueue API by requiring an additional int in every structure that we store in a pqueue to hold the index of that structure within the heap.
Diffstat (limited to 'src/common/container.h')
-rw-r--r--src/common/container.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/container.h b/src/common/container.h
index 41c0c6870..8077d56eb 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -118,11 +118,18 @@ int smartlist_bsearch_idx(const smartlist_t *sl, const void *key,
void smartlist_pqueue_add(smartlist_t *sl,
int (*compare)(const void *a, const void *b),
+ int idx_field_offset,
void *item);
void *smartlist_pqueue_pop(smartlist_t *sl,
- int (*compare)(const void *a, const void *b));
+ int (*compare)(const void *a, const void *b),
+ int idx_field_offset);
+void smartlist_pqueue_remove(smartlist_t *sl,
+ int (*compare)(const void *a, const void *b),
+ int idx_field_offset,
+ void *item);
void smartlist_pqueue_assert_ok(smartlist_t *sl,
- int (*compare)(const void *a, const void *b));
+ int (*compare)(const void *a, const void *b),
+ int idx_field_offset);
#define SPLIT_SKIP_SPACE 0x01
#define SPLIT_IGNORE_BLANK 0x02