mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +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:
@ -35,34 +35,34 @@ Datum gbt_cash_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_cashgt(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) > *((Cash *) b));
|
||||
return (*((const Cash *) a) > *((const Cash *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_cashge(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) >= *((Cash *) b));
|
||||
return (*((const Cash *) a) >= *((const Cash *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_casheq(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) == *((Cash *) b));
|
||||
return (*((const Cash *) a) == *((const Cash *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_cashle(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) <= *((Cash *) b));
|
||||
return (*((const Cash *) a) <= *((const Cash *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_cashlt(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) < *((Cash *) b));
|
||||
return (*((const Cash *) a) < *((const Cash *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_cashkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
cashKEY *ia = (cashKEY *) (((Nsrt *) a)->t);
|
||||
cashKEY *ib = (cashKEY *) (((Nsrt *) b)->t);
|
||||
cashKEY *ia = (cashKEY *) (((const Nsrt *) a)->t);
|
||||
cashKEY *ib = (cashKEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ static bool
|
||||
gbt_dategt(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_gt, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_gt, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ static bool
|
||||
gbt_datege(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_ge, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_ge, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ static bool
|
||||
gbt_dateeq(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_eq, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_eq, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ static bool
|
||||
gbt_datele(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_le, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_le, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ static bool
|
||||
gbt_datelt(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_lt, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_lt, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -77,8 +77,8 @@ gbt_datelt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_datekey_cmp(const void *a, const void *b)
|
||||
{
|
||||
dateKEY *ia = (dateKEY *) (((Nsrt *) a)->t);
|
||||
dateKEY *ib = (dateKEY *) (((Nsrt *) b)->t);
|
||||
dateKEY *ia = (dateKEY *) (((const Nsrt *) a)->t);
|
||||
dateKEY *ib = (dateKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(date_cmp, DateADTGetDatum(ia->lower), DateADTGetDatum(ib->lower)));
|
||||
|
@ -34,34 +34,34 @@ Datum gbt_float4_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_float4gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) > *((float4 *) b));
|
||||
return (*((const float4 *) a) > *((const float4 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float4ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) >= *((float4 *) b));
|
||||
return (*((const float4 *) a) >= *((const float4 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float4eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) == *((float4 *) b));
|
||||
return (*((const float4 *) a) == *((const float4 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float4le(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) <= *((float4 *) b));
|
||||
return (*((const float4 *) a) <= *((const float4 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float4lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) < *((float4 *) b));
|
||||
return (*((const float4 *) a) < *((const float4 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_float4key_cmp(const void *a, const void *b)
|
||||
{
|
||||
float4KEY *ia = (float4KEY *) (((Nsrt *) a)->t);
|
||||
float4KEY *ib = (float4KEY *) (((Nsrt *) b)->t);
|
||||
float4KEY *ia = (float4KEY *) (((const Nsrt *) a)->t);
|
||||
float4KEY *ib = (float4KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -35,34 +35,34 @@ Datum gbt_float8_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_float8gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) > *((float8 *) b));
|
||||
return (*((const float8 *) a) > *((const float8 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float8ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) >= *((float8 *) b));
|
||||
return (*((const float8 *) a) >= *((const float8 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float8eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) == *((float8 *) b));
|
||||
return (*((const float8 *) a) == *((const float8 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float8le(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) <= *((float8 *) b));
|
||||
return (*((const float8 *) a) <= *((const float8 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float8lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) < *((float8 *) b));
|
||||
return (*((const float8 *) a) < *((const float8 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_float8key_cmp(const void *a, const void *b)
|
||||
{
|
||||
float8KEY *ia = (float8KEY *) (((Nsrt *) a)->t);
|
||||
float8KEY *ib = (float8KEY *) (((Nsrt *) b)->t);
|
||||
float8KEY *ia = (float8KEY *) (((const Nsrt *) a)->t);
|
||||
float8KEY *ib = (float8KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -36,34 +36,34 @@ Datum gbt_inet_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_inetgt(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) > *((double *) b));
|
||||
return (*((const double *) a) > *((const double *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_inetge(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) >= *((double *) b));
|
||||
return (*((const double *) a) >= *((const double *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_ineteq(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) == *((double *) b));
|
||||
return (*((const double *) a) == *((const double *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_inetle(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) <= *((double *) b));
|
||||
return (*((const double *) a) <= *((const double *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_inetlt(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) < *((double *) b));
|
||||
return (*((const double *) a) < *((const double *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_inetkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
inetKEY *ia = (inetKEY *) (((Nsrt *) a)->t);
|
||||
inetKEY *ib = (inetKEY *) (((Nsrt *) b)->t);
|
||||
inetKEY *ia = (inetKEY *) (((const Nsrt *) a)->t);
|
||||
inetKEY *ib = (inetKEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -34,34 +34,34 @@ Datum gbt_int2_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_int2gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) > *((int16 *) b));
|
||||
return (*((const int16 *) a) > *((const int16 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int2ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) >= *((int16 *) b));
|
||||
return (*((const int16 *) a) >= *((const int16 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int2eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) == *((int16 *) b));
|
||||
return (*((const int16 *) a) == *((const int16 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int2le(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) <= *((int16 *) b));
|
||||
return (*((const int16 *) a) <= *((const int16 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int2lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) < *((int16 *) b));
|
||||
return (*((const int16 *) a) < *((const int16 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_int2key_cmp(const void *a, const void *b)
|
||||
{
|
||||
int16KEY *ia = (int16KEY *) (((Nsrt *) a)->t);
|
||||
int16KEY *ib = (int16KEY *) (((Nsrt *) b)->t);
|
||||
int16KEY *ia = (int16KEY *) (((const Nsrt *) a)->t);
|
||||
int16KEY *ib = (int16KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -35,34 +35,34 @@ Datum gbt_int4_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_int4gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) > *((int32 *) b));
|
||||
return (*((const int32 *) a) > *((const int32 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int4ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) >= *((int32 *) b));
|
||||
return (*((const int32 *) a) >= *((const int32 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int4eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) == *((int32 *) b));
|
||||
return (*((const int32 *) a) == *((const int32 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int4le(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) <= *((int32 *) b));
|
||||
return (*((const int32 *) a) <= *((const int32 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int4lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) < *((int32 *) b));
|
||||
return (*((const int32 *) a) < *((const int32 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_int4key_cmp(const void *a, const void *b)
|
||||
{
|
||||
int32KEY *ia = (int32KEY *) (((Nsrt *) a)->t);
|
||||
int32KEY *ib = (int32KEY *) (((Nsrt *) b)->t);
|
||||
int32KEY *ia = (int32KEY *) (((const Nsrt *) a)->t);
|
||||
int32KEY *ib = (int32KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -35,34 +35,34 @@ Datum gbt_int8_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_int8gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) > *((int64 *) b));
|
||||
return (*((const int64 *) a) > *((const int64 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int8ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) >= *((int64 *) b));
|
||||
return (*((const int64 *) a) >= *((const int64 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int8eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) == *((int64 *) b));
|
||||
return (*((const int64 *) a) == *((const int64 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int8le(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) <= *((int64 *) b));
|
||||
return (*((const int64 *) a) <= *((const int64 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int8lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) < *((int64 *) b));
|
||||
return (*((const int64 *) a) < *((const int64 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_int8key_cmp(const void *a, const void *b)
|
||||
{
|
||||
int64KEY *ia = (int64KEY *) (((Nsrt *) a)->t);
|
||||
int64KEY *ib = (int64KEY *) (((Nsrt *) b)->t);
|
||||
int64KEY *ia = (int64KEY *) (((const Nsrt *) a)->t);
|
||||
int64KEY *ib = (int64KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -69,8 +69,8 @@ gbt_intvlt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_intvkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
intvKEY *ia = (intvKEY *) (((Nsrt *) a)->t);
|
||||
intvKEY *ib = (intvKEY *) (((Nsrt *) b)->t);
|
||||
intvKEY *ia = (intvKEY *) (((const Nsrt *) a)->t);
|
||||
intvKEY *ib = (intvKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(interval_cmp, IntervalPGetDatum(&ia->lower), IntervalPGetDatum(&ib->lower)));
|
||||
@ -90,7 +90,7 @@ intr2num(const Interval *i)
|
||||
static float8
|
||||
gbt_intv_dist(const void *a, const void *b)
|
||||
{
|
||||
return (float8) Abs(intr2num((Interval *) a) - intr2num((Interval *) b));
|
||||
return (float8) Abs(intr2num((const Interval *) a) - intr2num((const Interval *) b));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -65,8 +65,8 @@ gbt_macadlt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_macadkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
macKEY *ia = (macKEY *) (((Nsrt *) a)->t);
|
||||
macKEY *ib = (macKEY *) (((Nsrt *) b)->t);
|
||||
macKEY *ia = (macKEY *) (((const Nsrt *) a)->t);
|
||||
macKEY *ib = (macKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(macaddr_cmp, MacaddrPGetDatum(&ia->lower), MacaddrPGetDatum(&ib->lower)));
|
||||
|
@ -35,34 +35,34 @@ Datum gbt_oid_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_oidgt(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) > *((Oid *) b));
|
||||
return (*((const Oid *) a) > *((const Oid *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_oidge(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) >= *((Oid *) b));
|
||||
return (*((const Oid *) a) >= *((const Oid *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_oideq(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) == *((Oid *) b));
|
||||
return (*((const Oid *) a) == *((const Oid *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_oidle(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) <= *((Oid *) b));
|
||||
return (*((const Oid *) a) <= *((const Oid *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_oidlt(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) < *((Oid *) b));
|
||||
return (*((const Oid *) a) < *((const Oid *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_oidkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
oidKEY *ia = (oidKEY *) (((Nsrt *) a)->t);
|
||||
oidKEY *ib = (oidKEY *) (((Nsrt *) b)->t);
|
||||
oidKEY *ia = (oidKEY *) (((const Nsrt *) a)->t);
|
||||
oidKEY *ib = (oidKEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -105,8 +105,8 @@ gbt_timelt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_timekey_cmp(const void *a, const void *b)
|
||||
{
|
||||
timeKEY *ia = (timeKEY *) (((Nsrt *) a)->t);
|
||||
timeKEY *ib = (timeKEY *) (((Nsrt *) b)->t);
|
||||
timeKEY *ia = (timeKEY *) (((const Nsrt *) a)->t);
|
||||
timeKEY *ib = (timeKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(time_cmp, TimeADTGetDatumFast(ia->lower), TimeADTGetDatumFast(ib->lower)));
|
||||
|
@ -106,8 +106,8 @@ gbt_tslt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_tskey_cmp(const void *a, const void *b)
|
||||
{
|
||||
tsKEY *ia = (tsKEY *) (((Nsrt *) a)->t);
|
||||
tsKEY *ib = (tsKEY *) (((Nsrt *) b)->t);
|
||||
tsKEY *ia = (tsKEY *) (((const Nsrt *) a)->t);
|
||||
tsKEY *ib = (tsKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(timestamp_cmp, TimestampGetDatumFast(ia->lower), TimestampGetDatumFast(ib->lower)));
|
||||
|
Reference in New Issue
Block a user