mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
smartlist_pqueue: use ptrdiff_t instead of int for offsets.
This is technically correct, but should not matter in practice, since we don't use this on any structs whose size exceeds INT_MAX.
This commit is contained in:
parent
539158f2be
commit
dc199f40fb
@ -678,7 +678,7 @@ smartlist_sort_pointers(smartlist_t *sl)
|
||||
static inline void
|
||||
smartlist_heapify(smartlist_t *sl,
|
||||
int (*compare)(const void *a, const void *b),
|
||||
int idx_field_offset,
|
||||
ptrdiff_t idx_field_offset,
|
||||
int idx)
|
||||
{
|
||||
while (1) {
|
||||
@ -725,7 +725,7 @@ smartlist_heapify(smartlist_t *sl,
|
||||
void
|
||||
smartlist_pqueue_add(smartlist_t *sl,
|
||||
int (*compare)(const void *a, const void *b),
|
||||
int idx_field_offset,
|
||||
ptrdiff_t idx_field_offset,
|
||||
void *item)
|
||||
{
|
||||
int idx;
|
||||
@ -754,7 +754,7 @@ smartlist_pqueue_add(smartlist_t *sl,
|
||||
void *
|
||||
smartlist_pqueue_pop(smartlist_t *sl,
|
||||
int (*compare)(const void *a, const void *b),
|
||||
int idx_field_offset)
|
||||
ptrdiff_t idx_field_offset)
|
||||
{
|
||||
void *top;
|
||||
tor_assert(sl->num_used);
|
||||
@ -778,7 +778,7 @@ smartlist_pqueue_pop(smartlist_t *sl,
|
||||
void
|
||||
smartlist_pqueue_remove(smartlist_t *sl,
|
||||
int (*compare)(const void *a, const void *b),
|
||||
int idx_field_offset,
|
||||
ptrdiff_t idx_field_offset,
|
||||
void *item)
|
||||
{
|
||||
int idx = IDX_OF_ITEM(item);
|
||||
@ -802,7 +802,7 @@ smartlist_pqueue_remove(smartlist_t *sl,
|
||||
void
|
||||
smartlist_pqueue_assert_ok(smartlist_t *sl,
|
||||
int (*compare)(const void *a, const void *b),
|
||||
int idx_field_offset)
|
||||
ptrdiff_t idx_field_offset)
|
||||
{
|
||||
int i;
|
||||
for (i = sl->num_used - 1; i >= 0; --i) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
**/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "lib/smartlist_core/smartlist_core.h"
|
||||
#include "lib/smartlist_core/smartlist_foreach.h"
|
||||
@ -72,18 +73,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,
|
||||
ptrdiff_t idx_field_offset,
|
||||
void *item);
|
||||
void *smartlist_pqueue_pop(smartlist_t *sl,
|
||||
int (*compare)(const void *a, const void *b),
|
||||
int idx_field_offset);
|
||||
ptrdiff_t idx_field_offset);
|
||||
void smartlist_pqueue_remove(smartlist_t *sl,
|
||||
int (*compare)(const void *a, const void *b),
|
||||
int idx_field_offset,
|
||||
ptrdiff_t idx_field_offset,
|
||||
void *item);
|
||||
void smartlist_pqueue_assert_ok(smartlist_t *sl,
|
||||
int (*compare)(const void *a, const void *b),
|
||||
int idx_field_offset);
|
||||
ptrdiff_t idx_field_offset);
|
||||
|
||||
char *smartlist_join_strings(smartlist_t *sl, const char *join, int terminate,
|
||||
size_t *len_out) ATTR_MALLOC;
|
||||
|
Loading…
Reference in New Issue
Block a user