Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
petervdonovan and coderabbitai[bot] authored Jun 20, 2024
1 parent 6c51f7d commit ad6101c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/utils/pqueue_tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* 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*.
*/
// Casting through uintptr_t for safe conversion from pointer to integer type
static pqueue_pri_t pqueue_tag_get_priority(void* element) { return (pqueue_pri_t)(uintptr_t)element; }

/**
Expand Down Expand Up @@ -66,6 +67,7 @@ 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) {
// Use uintptr_t for safe casting from integer type to pointer
return (lf_tag_compare(((pqueue_tag_element_t*)(uintptr_t)priority1)->tag, ((pqueue_tag_element_t*)(uintptr_t)priority2)->tag));
}

Expand Down

0 comments on commit ad6101c

Please sign in to comment.