aboutsummaryrefslogtreecommitdiff
path: root/contrib/hstore
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/hstore')
-rw-r--r--contrib/hstore/hstore_gist.c2
-rw-r--r--contrib/hstore/hstore_io.c15
2 files changed, 9 insertions, 8 deletions
diff --git a/contrib/hstore/hstore_gist.c b/contrib/hstore/hstore_gist.c
index 800de48247e..f5c4b71eaff 100644
--- a/contrib/hstore/hstore_gist.c
+++ b/contrib/hstore/hstore_gist.c
@@ -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;
}
diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c
index fc39bebc58f..0eb48cf5806 100644
--- a/contrib/hstore/hstore_io.c
+++ b/contrib/hstore/hstore_io.c
@@ -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;
}
/*