mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Remove many -Wcast-qual warnings
This addresses only those cases that are easy to fix by adding or moving a const qualifier or removing an unnecessary cast. There are many more complicated cases remaining.
This commit is contained in:
@ -322,7 +322,7 @@ typedef struct
|
||||
static int
|
||||
comparecost(const void *a, const void *b)
|
||||
{
|
||||
return ((SPLITCOST *) a)->cost - ((SPLITCOST *) b)->cost;
|
||||
return ((const SPLITCOST *) a)->cost - ((const SPLITCOST *) b)->cost;
|
||||
}
|
||||
|
||||
|
||||
|
@ -276,24 +276,25 @@ parse_hstore(HSParser *state)
|
||||
static int
|
||||
comparePairs(const void *a, const void *b)
|
||||
{
|
||||
if (((Pairs *) a)->keylen == ((Pairs *) b)->keylen)
|
||||
const Pairs *pa = a;
|
||||
const Pairs *pb = b;
|
||||
|
||||
if (pa->keylen == pb->keylen)
|
||||
{
|
||||
int res = memcmp(((Pairs *) a)->key,
|
||||
((Pairs *) b)->key,
|
||||
((Pairs *) a)->keylen);
|
||||
int res = memcmp(pa->key, pb->key, pa->keylen);
|
||||
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
/* guarantee that needfree will be later */
|
||||
if (((Pairs *) b)->needfree == ((Pairs *) a)->needfree)
|
||||
if (pb->needfree == pa->needfree)
|
||||
return 0;
|
||||
else if (((Pairs *) a)->needfree)
|
||||
else if (pa->needfree)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
return (((Pairs *) a)->keylen > ((Pairs *) b)->keylen) ? 1 : -1;
|
||||
return (pa->keylen > pb->keylen) ? 1 : -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user