Skip to content

Commit

Permalink
Format and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
petervdonovan committed Jun 20, 2024
1 parent 6c51f7d commit 7640822
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 7 additions & 2 deletions core/utils/pqueue_tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
* element is also the priority. This function is of type pqueue_get_pri_f.
* @param element A pointer to a pqueue_tag_element_t, cast to void*.
*/
static pqueue_pri_t pqueue_tag_get_priority(void* element) { return (pqueue_pri_t)(uintptr_t)element; }
static pqueue_pri_t pqueue_tag_get_priority(void* element) {
// Suppress "error: cast from pointer to integer of different size" by casting to uintptr_t first.
return (pqueue_pri_t)(uintptr_t)element;
}

/**
* @brief Callback function to determine whether two elements are equivalent.
Expand Down Expand Up @@ -66,7 +69,9 @@ static void pqueue_tag_print_element(void* element) {
// Functions defined in pqueue_tag.h.

int pqueue_tag_compare(pqueue_pri_t priority1, pqueue_pri_t priority2) {
return (lf_tag_compare(((pqueue_tag_element_t*)(uintptr_t)priority1)->tag, ((pqueue_tag_element_t*)(uintptr_t)priority2)->tag));
// Suppress "error: cast from pointer to integer of different size" by casting to uintptr_t first.
return (lf_tag_compare(((pqueue_tag_element_t*)(uintptr_t)priority1)->tag,
((pqueue_tag_element_t*)(uintptr_t)priority2)->tag));
}

pqueue_tag_t* pqueue_tag_init(size_t initial_size) {
Expand Down
8 changes: 0 additions & 8 deletions include/core/utils/pqueue_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,6 @@ size_t pqueue_size(pqueue_t* q);
*/
int pqueue_insert(pqueue_t* q, void* d);

/**
* Move an existing entry to a different priority.
* @param q the queue
* @param new_pri the new priority
* @param d the entry
*/
void pqueue_change_priority(pqueue_t* q, pqueue_pri_t new_pri, void* d);

/**
* Pop the highest-ranking item from the queue.
* @param q the queue
Expand Down

0 comments on commit 7640822

Please sign in to comment.