Remove superfluous casts
- Every non-const pointer converts automatically to void *. - Every pointer converts automatically to void *. - void * converts to any other pointer. - const void * converts to any other const pointer. - Integer variables convert to each other. I changed the declaration of a few variables in order to allow removing a cast. However, I didn't attempt to edit casts inside comparisons, since they are very delicate. I also kept casts in variadic functions, since they are necessary, and in allocation functions, because I have other plans for them. I also changed a few casts to int that are better as ptrdiff_t. This change has triggered some warnings about const correctness issues, which have also been fixed in this patch (see for example src/login.c). Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
66daa74232
commit
bddcd9b095
@ -355,13 +355,14 @@ static int subordinate_range_cmp (const void *p1, const void *p2)
|
||||
{
|
||||
struct subordinate_range *range1, *range2;
|
||||
|
||||
if ((*(struct commonio_entry **) p1)->eptr == NULL)
|
||||
return 1;
|
||||
if ((*(struct commonio_entry **) p2)->eptr == NULL)
|
||||
return -1;
|
||||
|
||||
range1 = ((struct subordinate_range *) (*(struct commonio_entry **) p1)->eptr);
|
||||
range2 = ((struct subordinate_range *) (*(struct commonio_entry **) p2)->eptr);
|
||||
range1 = (*(struct commonio_entry **) p1)->eptr;
|
||||
if (range1 == NULL)
|
||||
return 1;
|
||||
|
||||
range2 = (*(struct commonio_entry **) p2)->eptr;
|
||||
if (range2 == NULL)
|
||||
return -1;
|
||||
|
||||
if (range1->start < range2->start)
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user