mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-23 19:39:53 +08:00
Remove useless casts to (void *) in arguments of some system functions
The affected functions are: bsearch, memcmp, memcpy, memset, memmove, qsort, repalloc Reviewed-by: Corey Huinker <corey.huinker@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/fd9adf5d-b1aa-e82f-e4c7-263c30145807%40enterprisedb.com
This commit is contained in:
parent
d9d7fe68d3
commit
aa69541046
@ -84,7 +84,7 @@ gbt_bit_xfrm(bytea *leaf)
|
|||||||
while (sz < padded_sz)
|
while (sz < padded_sz)
|
||||||
((char *) out)[sz++] = 0;
|
((char *) out)[sz++] = 0;
|
||||||
SET_VARSIZE(out, padded_sz);
|
SET_VARSIZE(out, padded_sz);
|
||||||
memcpy((void *) VARDATA(out), (void *) VARBITS(leaf), VARBITBYTES(leaf));
|
memcpy(VARDATA(out), VARBITS(leaf), VARBITBYTES(leaf));
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +157,8 @@ gbt_intv_compress(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
Interval *key = DatumGetIntervalP(entry->key);
|
Interval *key = DatumGetIntervalP(entry->key);
|
||||||
|
|
||||||
memcpy((void *) r, (void *) key, INTERVALSIZE);
|
memcpy(r, key, INTERVALSIZE);
|
||||||
memcpy((void *) (r + INTERVALSIZE), (void *) key, INTERVALSIZE);
|
memcpy(r + INTERVALSIZE, key, INTERVALSIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -87,8 +87,8 @@ gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo)
|
|||||||
|
|
||||||
Assert(tinfo->indexsize >= 2 * tinfo->size);
|
Assert(tinfo->indexsize >= 2 * tinfo->size);
|
||||||
|
|
||||||
memcpy((void *) &r[0], leaf, tinfo->size);
|
memcpy(&r[0], leaf, tinfo->size);
|
||||||
memcpy((void *) &r[tinfo->size], leaf, tinfo->size);
|
memcpy(&r[tinfo->size], leaf, tinfo->size);
|
||||||
retval = palloc(sizeof(GISTENTRY));
|
retval = palloc(sizeof(GISTENTRY));
|
||||||
gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page,
|
gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page,
|
||||||
entry->offset, false);
|
entry->offset, false);
|
||||||
@ -184,7 +184,7 @@ gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_nin
|
|||||||
o.lower = &((GBT_NUMKEY *) out)[0];
|
o.lower = &((GBT_NUMKEY *) out)[0];
|
||||||
o.upper = &((GBT_NUMKEY *) out)[tinfo->size];
|
o.upper = &((GBT_NUMKEY *) out)[tinfo->size];
|
||||||
|
|
||||||
memcpy((void *) out, (void *) cur, 2 * tinfo->size);
|
memcpy(out, cur, 2 * tinfo->size);
|
||||||
|
|
||||||
for (i = 1; i < numranges; i++)
|
for (i = 1; i < numranges; i++)
|
||||||
{
|
{
|
||||||
@ -360,7 +360,7 @@ gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
|||||||
arr[i].t = (GBT_NUMKEY *) DatumGetPointer((entryvec->vector[i].key));
|
arr[i].t = (GBT_NUMKEY *) DatumGetPointer((entryvec->vector[i].key));
|
||||||
arr[i].i = i;
|
arr[i].i = i;
|
||||||
}
|
}
|
||||||
qsort_arg((void *) &arr[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1, sizeof(Nsrt), (qsort_arg_comparator) tinfo->f_cmp, (void *) flinfo);
|
qsort_arg(&arr[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1, sizeof(Nsrt), (qsort_arg_comparator) tinfo->f_cmp, flinfo);
|
||||||
|
|
||||||
/* We do simply create two parts */
|
/* We do simply create two parts */
|
||||||
|
|
||||||
|
@ -502,11 +502,11 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
|
|||||||
varg.tinfo = tinfo;
|
varg.tinfo = tinfo;
|
||||||
varg.collation = collation;
|
varg.collation = collation;
|
||||||
varg.flinfo = flinfo;
|
varg.flinfo = flinfo;
|
||||||
qsort_arg((void *) &arr[FirstOffsetNumber],
|
qsort_arg(&arr[FirstOffsetNumber],
|
||||||
maxoff - FirstOffsetNumber + 1,
|
maxoff - FirstOffsetNumber + 1,
|
||||||
sizeof(Vsrt),
|
sizeof(Vsrt),
|
||||||
gbt_vsrt_cmp,
|
gbt_vsrt_cmp,
|
||||||
(void *) &varg);
|
&varg);
|
||||||
|
|
||||||
/* We do simply create two parts */
|
/* We do simply create two parts */
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ gbt_uuid_compress(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
retval = palloc(sizeof(GISTENTRY));
|
retval = palloc(sizeof(GISTENTRY));
|
||||||
|
|
||||||
memcpy((void *) r, (void *) key, UUID_LEN);
|
memcpy(r, key, UUID_LEN);
|
||||||
memcpy((void *) (r + UUID_LEN), (void *) key, UUID_LEN);
|
memcpy(r + UUID_LEN, key, UUID_LEN);
|
||||||
gistentryinit(*retval, PointerGetDatum(r),
|
gistentryinit(*retval, PointerGetDatum(r),
|
||||||
entry->rel, entry->page,
|
entry->rel, entry->page,
|
||||||
entry->offset, false);
|
entry->offset, false);
|
||||||
|
@ -80,7 +80,7 @@ internal_citext_pattern_cmp(text *left, text *right, Oid collid)
|
|||||||
llen = strlen(lcstr);
|
llen = strlen(lcstr);
|
||||||
rlen = strlen(rcstr);
|
rlen = strlen(rcstr);
|
||||||
|
|
||||||
result = memcmp((void *) lcstr, (void *) rcstr, Min(llen, rlen));
|
result = memcmp(lcstr, rcstr, Min(llen, rlen));
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
if (llen < rlen)
|
if (llen < rlen)
|
||||||
|
@ -436,7 +436,7 @@ ghstore_picksplit(PG_FUNCTION_ARGS)
|
|||||||
size_beta = hemdist(datum_r, _j, siglen);
|
size_beta = hemdist(datum_r, _j, siglen);
|
||||||
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
||||||
}
|
}
|
||||||
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
qsort(costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
||||||
|
|
||||||
union_l = GETSIGN(datum_l);
|
union_l = GETSIGN(datum_l);
|
||||||
union_r = GETSIGN(datum_r);
|
union_r = GETSIGN(datum_r);
|
||||||
@ -465,7 +465,7 @@ ghstore_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (ISALLTRUE(datum_l) || ISALLTRUE(_j))
|
if (ISALLTRUE(datum_l) || ISALLTRUE(_j))
|
||||||
{
|
{
|
||||||
if (!ISALLTRUE(datum_l))
|
if (!ISALLTRUE(datum_l))
|
||||||
memset((void *) union_l, 0xff, siglen);
|
memset(union_l, 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -481,7 +481,7 @@ ghstore_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (ISALLTRUE(datum_r) || ISALLTRUE(_j))
|
if (ISALLTRUE(datum_r) || ISALLTRUE(_j))
|
||||||
{
|
{
|
||||||
if (!ISALLTRUE(datum_r))
|
if (!ISALLTRUE(datum_r))
|
||||||
memset((void *) union_r, 0xff, siglen);
|
memset(union_r, 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -365,7 +365,7 @@ hstoreUniquePairs(Pairs *a, int32 l, int32 *buflen)
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort((void *) a, l, sizeof(Pairs), comparePairs);
|
qsort(a, l, sizeof(Pairs), comparePairs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can't use qunique here because we have some clean-up code to run on
|
* We can't use qunique here because we have some clean-up code to run on
|
||||||
|
@ -243,7 +243,7 @@ g_int_compress(PG_FUNCTION_ARGS)
|
|||||||
/*
|
/*
|
||||||
* shunt everything down to start at the right place
|
* shunt everything down to start at the right place
|
||||||
*/
|
*/
|
||||||
memmove((void *) &dr[0], (void *) &dr[2 * j], 2 * (len - j) * sizeof(int32));
|
memmove(&dr[0], &dr[2 * j], 2 * (len - j) * sizeof(int32));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -260,7 +260,7 @@ g_int_compress(PG_FUNCTION_ARGS)
|
|||||||
min = ((int64) dr[i] - (int64) dr[i - 1]);
|
min = ((int64) dr[i] - (int64) dr[i - 1]);
|
||||||
cand = i;
|
cand = i;
|
||||||
}
|
}
|
||||||
memmove((void *) &dr[cand - 1], (void *) &dr[cand + 1], (len - cand - 1) * sizeof(int32));
|
memmove(&dr[cand - 1], &dr[cand + 1], (len - cand - 1) * sizeof(int32));
|
||||||
len -= 2;
|
len -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ g_int_picksplit(PG_FUNCTION_ARGS)
|
|||||||
pfree(union_d);
|
pfree(union_d);
|
||||||
costvector[i - 1].cost = fabsf((size_alpha - size_l) - (size_beta - size_r));
|
costvector[i - 1].cost = fabsf((size_alpha - size_l) - (size_beta - size_r));
|
||||||
}
|
}
|
||||||
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
qsort(costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now split up the regions between the two seeds. An important property
|
* Now split up the regions between the two seeds. An important property
|
||||||
|
@ -212,7 +212,7 @@ isort(int32 *a, int len)
|
|||||||
{
|
{
|
||||||
bool r = false;
|
bool r = false;
|
||||||
|
|
||||||
qsort_arg(a, len, sizeof(int32), isort_cmp, (void *) &r);
|
qsort_arg(a, len, sizeof(int32), isort_cmp, &r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ g_intbig_picksplit(PG_FUNCTION_ARGS)
|
|||||||
size_beta = hemdist(datum_r, _j, siglen);
|
size_beta = hemdist(datum_r, _j, siglen);
|
||||||
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
||||||
}
|
}
|
||||||
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
qsort(costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
||||||
|
|
||||||
union_l = GETSIGN(datum_l);
|
union_l = GETSIGN(datum_l);
|
||||||
union_r = GETSIGN(datum_r);
|
union_r = GETSIGN(datum_r);
|
||||||
@ -424,7 +424,7 @@ g_intbig_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (ISALLTRUE(datum_l) || ISALLTRUE(_j))
|
if (ISALLTRUE(datum_l) || ISALLTRUE(_j))
|
||||||
{
|
{
|
||||||
if (!ISALLTRUE(datum_l))
|
if (!ISALLTRUE(datum_l))
|
||||||
memset((void *) union_l, 0xff, siglen);
|
memset(union_l, 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -440,7 +440,7 @@ g_intbig_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (ISALLTRUE(datum_r) || ISALLTRUE(_j))
|
if (ISALLTRUE(datum_r) || ISALLTRUE(_j))
|
||||||
{
|
{
|
||||||
if (!ISALLTRUE(datum_r))
|
if (!ISALLTRUE(datum_r))
|
||||||
memset((void *) union_r, 0xff, siglen);
|
memset(union_r, 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -319,7 +319,7 @@ _ltree_picksplit(PG_FUNCTION_ARGS)
|
|||||||
size_beta = hemdist(datum_r, _j, siglen);
|
size_beta = hemdist(datum_r, _j, siglen);
|
||||||
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
||||||
}
|
}
|
||||||
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
qsort(costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
||||||
|
|
||||||
union_l = LTG_SIGN(datum_l);
|
union_l = LTG_SIGN(datum_l);
|
||||||
union_r = LTG_SIGN(datum_r);
|
union_r = LTG_SIGN(datum_r);
|
||||||
@ -348,7 +348,7 @@ _ltree_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (LTG_ISALLTRUE(datum_l) || LTG_ISALLTRUE(_j))
|
if (LTG_ISALLTRUE(datum_l) || LTG_ISALLTRUE(_j))
|
||||||
{
|
{
|
||||||
if (!LTG_ISALLTRUE(datum_l))
|
if (!LTG_ISALLTRUE(datum_l))
|
||||||
memset((void *) union_l, 0xff, siglen);
|
memset(union_l, 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -364,7 +364,7 @@ _ltree_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (LTG_ISALLTRUE(datum_r) || LTG_ISALLTRUE(_j))
|
if (LTG_ISALLTRUE(datum_r) || LTG_ISALLTRUE(_j))
|
||||||
{
|
{
|
||||||
if (!LTG_ISALLTRUE(datum_r))
|
if (!LTG_ISALLTRUE(datum_r))
|
||||||
memset((void *) union_r, 0xff, siglen);
|
memset(union_r, 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -328,7 +328,7 @@ ltree_picksplit(PG_FUNCTION_ARGS)
|
|||||||
array[j].r = LTG_GETLNODE(lu, siglen);
|
array[j].r = LTG_GETLNODE(lu, siglen);
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort((void *) &array[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1,
|
qsort(&array[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1,
|
||||||
sizeof(RIX), treekey_cmp);
|
sizeof(RIX), treekey_cmp);
|
||||||
|
|
||||||
lu_l = lu_r = ru_l = ru_r = NULL;
|
lu_l = lu_r = ru_l = ru_r = NULL;
|
||||||
|
@ -195,10 +195,10 @@ pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag)
|
|||||||
int32 tmp = state->curop - state->op;
|
int32 tmp = state->curop - state->op;
|
||||||
|
|
||||||
state->lenop *= 2;
|
state->lenop *= 2;
|
||||||
state->op = (char *) repalloc((void *) state->op, state->lenop);
|
state->op = (char *) repalloc(state->op, state->lenop);
|
||||||
state->curop = state->op + tmp;
|
state->curop = state->op + tmp;
|
||||||
}
|
}
|
||||||
memcpy((void *) state->curop, (void *) strval, lenval);
|
memcpy(state->curop, strval, lenval);
|
||||||
state->curop += lenval;
|
state->curop += lenval;
|
||||||
*(state->curop) = '\0';
|
*(state->curop) = '\0';
|
||||||
state->curop++;
|
state->curop++;
|
||||||
@ -391,7 +391,7 @@ queryin(char *buf, struct Node *escontext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set user-friendly operand view */
|
/* set user-friendly operand view */
|
||||||
memcpy((void *) GETOPERAND(query), (void *) state.op, state.sumlen);
|
memcpy(GETOPERAND(query), state.op, state.sumlen);
|
||||||
pfree(state.op);
|
pfree(state.op);
|
||||||
|
|
||||||
/* set left operand's position for every operator */
|
/* set left operand's position for every operator */
|
||||||
|
@ -131,7 +131,7 @@ heap_force_common(FunctionCallInfo fcinfo, HeapTupleForceOption heap_force_opt)
|
|||||||
* array.
|
* array.
|
||||||
*/
|
*/
|
||||||
if (ntids > 1)
|
if (ntids > 1)
|
||||||
qsort((void *) tids, ntids, sizeof(ItemPointerData), tidcmp);
|
qsort(tids, ntids, sizeof(ItemPointerData), tidcmp);
|
||||||
|
|
||||||
curr_start_ptr = next_start_ptr = 0;
|
curr_start_ptr = next_start_ptr = 0;
|
||||||
nblocks = RelationGetNumberOfBlocks(rel);
|
nblocks = RelationGetNumberOfBlocks(rel);
|
||||||
|
@ -102,7 +102,7 @@ makesign(BITVECP sign, TRGM *a, int siglen)
|
|||||||
trgm *ptr = GETARR(a);
|
trgm *ptr = GETARR(a);
|
||||||
int32 tmp = 0;
|
int32 tmp = 0;
|
||||||
|
|
||||||
MemSet((void *) sign, 0, siglen);
|
MemSet(sign, 0, siglen);
|
||||||
SETBIT(sign, SIGLENBIT(siglen)); /* set last unused bit */
|
SETBIT(sign, SIGLENBIT(siglen)); /* set last unused bit */
|
||||||
for (k = 0; k < len; k++)
|
for (k = 0; k < len; k++)
|
||||||
{
|
{
|
||||||
@ -755,7 +755,7 @@ fillcache(CACHESIGN *item, TRGM *key, BITVECP sign, int siglen)
|
|||||||
else if (ISALLTRUE(key))
|
else if (ISALLTRUE(key))
|
||||||
item->allistrue = true;
|
item->allistrue = true;
|
||||||
else
|
else
|
||||||
memcpy((void *) item->sign, (void *) GETSIGN(key), siglen);
|
memcpy(item->sign, GETSIGN(key), siglen);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
|
#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
|
||||||
@ -872,7 +872,7 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
|
|||||||
size_beta = hemdistcache(&(cache[seed_2]), &(cache[j]), siglen);
|
size_beta = hemdistcache(&(cache[seed_2]), &(cache[j]), siglen);
|
||||||
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
||||||
}
|
}
|
||||||
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
qsort(costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
||||||
|
|
||||||
for (k = 0; k < maxoff; k++)
|
for (k = 0; k < maxoff; k++)
|
||||||
{
|
{
|
||||||
@ -921,7 +921,7 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (ISALLTRUE(datum_l) || cache[j].allistrue)
|
if (ISALLTRUE(datum_l) || cache[j].allistrue)
|
||||||
{
|
{
|
||||||
if (!ISALLTRUE(datum_l))
|
if (!ISALLTRUE(datum_l))
|
||||||
memset((void *) GETSIGN(datum_l), 0xff, siglen);
|
memset(GETSIGN(datum_l), 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -937,7 +937,7 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (ISALLTRUE(datum_r) || cache[j].allistrue)
|
if (ISALLTRUE(datum_r) || cache[j].allistrue)
|
||||||
{
|
{
|
||||||
if (!ISALLTRUE(datum_r))
|
if (!ISALLTRUE(datum_r))
|
||||||
memset((void *) GETSIGN(datum_r), 0xff, siglen);
|
memset(GETSIGN(datum_r), 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -376,7 +376,7 @@ generate_trgm(char *str, int slen)
|
|||||||
*/
|
*/
|
||||||
if (len > 1)
|
if (len > 1)
|
||||||
{
|
{
|
||||||
qsort((void *) GETARR(trg), len, sizeof(trgm), comp_trgm);
|
qsort(GETARR(trg), len, sizeof(trgm), comp_trgm);
|
||||||
len = qunique(GETARR(trg), len, sizeof(trgm), comp_trgm);
|
len = qunique(GETARR(trg), len, sizeof(trgm), comp_trgm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -929,7 +929,7 @@ generate_wildcard_trgm(const char *str, int slen)
|
|||||||
*/
|
*/
|
||||||
if (len > 1)
|
if (len > 1)
|
||||||
{
|
{
|
||||||
qsort((void *) GETARR(trg), len, sizeof(trgm), comp_trgm);
|
qsort(GETARR(trg), len, sizeof(trgm), comp_trgm);
|
||||||
len = qunique(GETARR(trg), len, sizeof(trgm), comp_trgm);
|
len = qunique(GETARR(trg), len, sizeof(trgm), comp_trgm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2456,8 +2456,8 @@ copytext(PG_FUNCTION_ARGS)
|
|||||||
* VARDATA is a pointer to the data region of the new struct. The source
|
* VARDATA is a pointer to the data region of the new struct. The source
|
||||||
* could be a short datum, so retrieve its data through VARDATA_ANY.
|
* could be a short datum, so retrieve its data through VARDATA_ANY.
|
||||||
*/
|
*/
|
||||||
memcpy((void *) VARDATA(new_t), /* destination */
|
memcpy(VARDATA(new_t), /* destination */
|
||||||
(void *) VARDATA_ANY(t), /* source */
|
VARDATA_ANY(t), /* source */
|
||||||
VARSIZE_ANY_EXHDR(t)); /* how many bytes */
|
VARSIZE_ANY_EXHDR(t)); /* how many bytes */
|
||||||
PG_RETURN_TEXT_P(new_t);
|
PG_RETURN_TEXT_P(new_t);
|
||||||
}
|
}
|
||||||
|
@ -543,7 +543,7 @@ range_deduplicate_values(Ranges *range)
|
|||||||
*/
|
*/
|
||||||
qsort_arg(&range->values[start],
|
qsort_arg(&range->values[start],
|
||||||
range->nvalues, sizeof(Datum),
|
range->nvalues, sizeof(Datum),
|
||||||
compare_values, (void *) &cxt);
|
compare_values, &cxt);
|
||||||
|
|
||||||
n = 1;
|
n = 1;
|
||||||
for (i = 1; i < range->nvalues; i++)
|
for (i = 1; i < range->nvalues; i++)
|
||||||
@ -1197,7 +1197,7 @@ sort_expanded_ranges(FmgrInfo *cmp, Oid colloid,
|
|||||||
* some of the points) and do merge sort.
|
* some of the points) and do merge sort.
|
||||||
*/
|
*/
|
||||||
qsort_arg(eranges, neranges, sizeof(ExpandedRange),
|
qsort_arg(eranges, neranges, sizeof(ExpandedRange),
|
||||||
compare_expanded_ranges, (void *) &cxt);
|
compare_expanded_ranges, &cxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deduplicate the ranges - simply compare each range to the preceding
|
* Deduplicate the ranges - simply compare each range to the preceding
|
||||||
@ -1535,7 +1535,7 @@ reduce_expanded_ranges(ExpandedRange *eranges, int neranges,
|
|||||||
* sorted result.
|
* sorted result.
|
||||||
*/
|
*/
|
||||||
qsort_arg(values, nvalues, sizeof(Datum),
|
qsort_arg(values, nvalues, sizeof(Datum),
|
||||||
compare_values, (void *) &cxt);
|
compare_values, &cxt);
|
||||||
|
|
||||||
/* We have nvalues boundary values, which means nvalues/2 ranges. */
|
/* We have nvalues boundary values, which means nvalues/2 ranges. */
|
||||||
for (i = 0; i < (nvalues / 2); i++)
|
for (i = 0; i < (nvalues / 2); i++)
|
||||||
|
@ -560,7 +560,7 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum,
|
|||||||
arg.collation = ginstate->supportCollation[attnum - 1];
|
arg.collation = ginstate->supportCollation[attnum - 1];
|
||||||
arg.haveDups = false;
|
arg.haveDups = false;
|
||||||
qsort_arg(keydata, *nentries, sizeof(keyEntryData),
|
qsort_arg(keydata, *nentries, sizeof(keyEntryData),
|
||||||
cmpEntries, (void *) &arg);
|
cmpEntries, &arg);
|
||||||
|
|
||||||
if (arg.haveDups)
|
if (arg.haveDups)
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,7 @@ gist_box_union(PG_FUNCTION_ARGS)
|
|||||||
numranges = entryvec->n;
|
numranges = entryvec->n;
|
||||||
pageunion = (BOX *) palloc(sizeof(BOX));
|
pageunion = (BOX *) palloc(sizeof(BOX));
|
||||||
cur = DatumGetBoxP(entryvec->vector[0].key);
|
cur = DatumGetBoxP(entryvec->vector[0].key);
|
||||||
memcpy((void *) pageunion, (void *) cur, sizeof(BOX));
|
memcpy(pageunion, cur, sizeof(BOX));
|
||||||
|
|
||||||
for (i = 1; i < numranges; i++)
|
for (i = 1; i < numranges; i++)
|
||||||
{
|
{
|
||||||
@ -1043,7 +1043,7 @@ gist_poly_compress(PG_FUNCTION_ARGS)
|
|||||||
BOX *r;
|
BOX *r;
|
||||||
|
|
||||||
r = (BOX *) palloc(sizeof(BOX));
|
r = (BOX *) palloc(sizeof(BOX));
|
||||||
memcpy((void *) r, (void *) &(in->boundbox), sizeof(BOX));
|
memcpy(r, &(in->boundbox), sizeof(BOX));
|
||||||
|
|
||||||
retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
|
retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
|
||||||
gistentryinit(*retval, PointerGetDatum(r),
|
gistentryinit(*retval, PointerGetDatum(r),
|
||||||
|
@ -113,7 +113,7 @@ gistextractpage(Page page, int *len /* out */ )
|
|||||||
IndexTuple *
|
IndexTuple *
|
||||||
gistjoinvector(IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen)
|
gistjoinvector(IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen)
|
||||||
{
|
{
|
||||||
itvec = (IndexTuple *) repalloc((void *) itvec, sizeof(IndexTuple) * ((*len) + addlen));
|
itvec = (IndexTuple *) repalloc(itvec, sizeof(IndexTuple) * ((*len) + addlen));
|
||||||
memmove(&itvec[*len], additvec, sizeof(IndexTuple) * addlen);
|
memmove(&itvec[*len], additvec, sizeof(IndexTuple) * addlen);
|
||||||
*len += addlen;
|
*len += addlen;
|
||||||
return itvec;
|
return itvec;
|
||||||
|
@ -488,8 +488,8 @@ _bt_sort_array_elements(IndexScanDesc scan, ScanKey skey,
|
|||||||
fmgr_info(cmp_proc, &cxt.flinfo);
|
fmgr_info(cmp_proc, &cxt.flinfo);
|
||||||
cxt.collation = skey->sk_collation;
|
cxt.collation = skey->sk_collation;
|
||||||
cxt.reverse = reverse;
|
cxt.reverse = reverse;
|
||||||
qsort_arg((void *) elems, nelems, sizeof(Datum),
|
qsort_arg(elems, nelems, sizeof(Datum),
|
||||||
_bt_compare_array_elements, (void *) &cxt);
|
_bt_compare_array_elements, &cxt);
|
||||||
|
|
||||||
/* Now scan the sorted elements and remove duplicates */
|
/* Now scan the sorted elements and remove duplicates */
|
||||||
return qunique_arg(elems, nelems, sizeof(Datum),
|
return qunique_arg(elems, nelems, sizeof(Datum),
|
||||||
|
@ -967,7 +967,7 @@ findDependentObjects(const ObjectAddress *object,
|
|||||||
* first within ObjectAddressAndFlags.
|
* first within ObjectAddressAndFlags.
|
||||||
*/
|
*/
|
||||||
if (numDependentObjects > 1)
|
if (numDependentObjects > 1)
|
||||||
qsort((void *) dependentObjects, numDependentObjects,
|
qsort(dependentObjects, numDependentObjects,
|
||||||
sizeof(ObjectAddressAndFlags),
|
sizeof(ObjectAddressAndFlags),
|
||||||
object_address_comparator);
|
object_address_comparator);
|
||||||
|
|
||||||
@ -2442,7 +2442,7 @@ eliminate_duplicate_dependencies(ObjectAddresses *addrs)
|
|||||||
return; /* nothing to do */
|
return; /* nothing to do */
|
||||||
|
|
||||||
/* Sort the refs so that duplicates are adjacent */
|
/* Sort the refs so that duplicates are adjacent */
|
||||||
qsort((void *) addrs->refs, addrs->numrefs, sizeof(ObjectAddress),
|
qsort(addrs->refs, addrs->numrefs, sizeof(ObjectAddress),
|
||||||
object_address_comparator);
|
object_address_comparator);
|
||||||
|
|
||||||
/* Remove dups */
|
/* Remove dups */
|
||||||
@ -2809,7 +2809,7 @@ void
|
|||||||
sort_object_addresses(ObjectAddresses *addrs)
|
sort_object_addresses(ObjectAddresses *addrs)
|
||||||
{
|
{
|
||||||
if (addrs->numrefs > 1)
|
if (addrs->numrefs > 1)
|
||||||
qsort((void *) addrs->refs, addrs->numrefs,
|
qsort(addrs->refs, addrs->numrefs,
|
||||||
sizeof(ObjectAddress),
|
sizeof(ObjectAddress),
|
||||||
object_address_comparator);
|
object_address_comparator);
|
||||||
}
|
}
|
||||||
|
@ -762,7 +762,7 @@ checkSharedDependencies(Oid classId, Oid objectId,
|
|||||||
* Sort and report local and shared objects.
|
* Sort and report local and shared objects.
|
||||||
*/
|
*/
|
||||||
if (numobjects > 1)
|
if (numobjects > 1)
|
||||||
qsort((void *) objects, numobjects,
|
qsort(objects, numobjects,
|
||||||
sizeof(ShDependObjectInfo), shared_dependency_comparator);
|
sizeof(ShDependObjectInfo), shared_dependency_comparator);
|
||||||
|
|
||||||
for (int i = 0; i < numobjects; i++)
|
for (int i = 0; i < numobjects; i++)
|
||||||
|
@ -1304,7 +1304,7 @@ acquire_sample_rows(Relation onerel, int elevel,
|
|||||||
* tuples are already sorted.
|
* tuples are already sorted.
|
||||||
*/
|
*/
|
||||||
if (numrows == targrows)
|
if (numrows == targrows)
|
||||||
qsort_interruptible((void *) rows, numrows, sizeof(HeapTuple),
|
qsort_interruptible(rows, numrows, sizeof(HeapTuple),
|
||||||
compare_rows, NULL);
|
compare_rows, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2479,8 +2479,8 @@ compute_scalar_stats(VacAttrStatsP stats,
|
|||||||
/* Sort the collected values */
|
/* Sort the collected values */
|
||||||
cxt.ssup = &ssup;
|
cxt.ssup = &ssup;
|
||||||
cxt.tupnoLink = tupnoLink;
|
cxt.tupnoLink = tupnoLink;
|
||||||
qsort_interruptible((void *) values, values_cnt, sizeof(ScalarItem),
|
qsort_interruptible(values, values_cnt, sizeof(ScalarItem),
|
||||||
compare_scalars, (void *) &cxt);
|
compare_scalars, &cxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now scan the values in order, find the most common ones, and also
|
* Now scan the values in order, find the most common ones, and also
|
||||||
@ -2724,7 +2724,7 @@ compute_scalar_stats(VacAttrStatsP stats,
|
|||||||
deltafrac;
|
deltafrac;
|
||||||
|
|
||||||
/* Sort the MCV items into position order to speed next loop */
|
/* Sort the MCV items into position order to speed next loop */
|
||||||
qsort_interruptible((void *) track, num_mcv, sizeof(ScalarMCVItem),
|
qsort_interruptible(track, num_mcv, sizeof(ScalarMCVItem),
|
||||||
compare_mcvs, NULL);
|
compare_mcvs, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -878,7 +878,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
|
|||||||
* created such a pg_collation entry above, and that one will win.)
|
* created such a pg_collation entry above, and that one will win.)
|
||||||
*/
|
*/
|
||||||
if (naliases > 1)
|
if (naliases > 1)
|
||||||
qsort((void *) aliases, naliases, sizeof(CollAliasData), cmpaliases);
|
qsort(aliases, naliases, sizeof(CollAliasData), cmpaliases);
|
||||||
|
|
||||||
/* Now add aliases, ignoring any that match pre-existing entries */
|
/* Now add aliases, ignoring any that match pre-existing entries */
|
||||||
for (i = 0; i < naliases; i++)
|
for (i = 0; i < naliases; i++)
|
||||||
|
@ -2384,8 +2384,8 @@ vac_tid_reaped(ItemPointer itemptr, void *state)
|
|||||||
if (item < litem || item > ritem)
|
if (item < litem || item > ritem)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
res = (ItemPointer) bsearch((void *) itemptr,
|
res = (ItemPointer) bsearch(itemptr,
|
||||||
(void *) dead_items->items,
|
dead_items->items,
|
||||||
dead_items->num_items,
|
dead_items->num_items,
|
||||||
sizeof(ItemPointerData),
|
sizeof(ItemPointerData),
|
||||||
vac_cmp_itemptr);
|
vac_cmp_itemptr);
|
||||||
|
@ -266,7 +266,7 @@ TidListEval(TidScanState *tidstate)
|
|||||||
/* CurrentOfExpr could never appear OR'd with something else */
|
/* CurrentOfExpr could never appear OR'd with something else */
|
||||||
Assert(!tidstate->tss_isCurrentOf);
|
Assert(!tidstate->tss_isCurrentOf);
|
||||||
|
|
||||||
qsort((void *) tidList, numTids, sizeof(ItemPointerData),
|
qsort(tidList, numTids, sizeof(ItemPointerData),
|
||||||
itemptr_comparator);
|
itemptr_comparator);
|
||||||
numTids = qunique(tidList, numTids, sizeof(ItemPointerData),
|
numTids = qunique(tidList, numTids, sizeof(ItemPointerData),
|
||||||
itemptr_comparator);
|
itemptr_comparator);
|
||||||
|
@ -853,11 +853,11 @@ tbm_prepare_shared_iterate(TIDBitmap *tbm)
|
|||||||
if (ptbase != NULL)
|
if (ptbase != NULL)
|
||||||
pg_atomic_init_u32(&ptbase->refcount, 0);
|
pg_atomic_init_u32(&ptbase->refcount, 0);
|
||||||
if (npages > 1)
|
if (npages > 1)
|
||||||
qsort_arg((void *) (ptpages->index), npages, sizeof(int),
|
qsort_arg(ptpages->index, npages, sizeof(int),
|
||||||
tbm_shared_comparator, (void *) ptbase->ptentry);
|
tbm_shared_comparator, ptbase->ptentry);
|
||||||
if (nchunks > 1)
|
if (nchunks > 1)
|
||||||
qsort_arg((void *) (ptchunks->index), nchunks, sizeof(int),
|
qsort_arg(ptchunks->index, nchunks, sizeof(int),
|
||||||
tbm_shared_comparator, (void *) ptbase->ptentry);
|
tbm_shared_comparator, ptbase->ptentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -531,7 +531,7 @@ create_list_bounds(PartitionBoundSpec **boundspecs, int nparts,
|
|||||||
Assert(j == ndatums);
|
Assert(j == ndatums);
|
||||||
|
|
||||||
qsort_arg(all_values, ndatums, sizeof(PartitionListValue),
|
qsort_arg(all_values, ndatums, sizeof(PartitionListValue),
|
||||||
qsort_partition_list_value_cmp, (void *) key);
|
qsort_partition_list_value_cmp, key);
|
||||||
|
|
||||||
boundinfo->ndatums = ndatums;
|
boundinfo->ndatums = ndatums;
|
||||||
boundinfo->datums = (Datum **) palloc0(ndatums * sizeof(Datum *));
|
boundinfo->datums = (Datum **) palloc0(ndatums * sizeof(Datum *));
|
||||||
@ -737,7 +737,7 @@ create_range_bounds(PartitionBoundSpec **boundspecs, int nparts,
|
|||||||
qsort_arg(all_bounds, ndatums,
|
qsort_arg(all_bounds, ndatums,
|
||||||
sizeof(PartitionRangeBound *),
|
sizeof(PartitionRangeBound *),
|
||||||
qsort_partition_rbound_cmp,
|
qsort_partition_rbound_cmp,
|
||||||
(void *) key);
|
key);
|
||||||
|
|
||||||
/* Save distinct bounds from all_bounds into rbounds. */
|
/* Save distinct bounds from all_bounds into rbounds. */
|
||||||
rbounds = (PartitionRangeBound **)
|
rbounds = (PartitionRangeBound **)
|
||||||
|
@ -1129,7 +1129,7 @@ build_sorted_items(StatsBuildData *data, int *nitems,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* do the sort, using the multi-sort */
|
/* do the sort, using the multi-sort */
|
||||||
qsort_interruptible((void *) items, nrows, sizeof(SortItem),
|
qsort_interruptible(items, nrows, sizeof(SortItem),
|
||||||
multi_sort_compare, mss);
|
multi_sort_compare, mss);
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
@ -457,7 +457,7 @@ build_distinct_groups(int numrows, SortItem *items, MultiSortSupport mss,
|
|||||||
Assert(j + 1 == ngroups);
|
Assert(j + 1 == ngroups);
|
||||||
|
|
||||||
/* Sort the distinct groups by frequency (in descending order). */
|
/* Sort the distinct groups by frequency (in descending order). */
|
||||||
qsort_interruptible((void *) groups, ngroups, sizeof(SortItem),
|
qsort_interruptible(groups, ngroups, sizeof(SortItem),
|
||||||
compare_sort_item_count, NULL);
|
compare_sort_item_count, NULL);
|
||||||
|
|
||||||
*ndistinct = ngroups;
|
*ndistinct = ngroups;
|
||||||
@ -528,7 +528,7 @@ build_column_frequencies(SortItem *groups, int ngroups,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* sort the values, deduplicate */
|
/* sort the values, deduplicate */
|
||||||
qsort_interruptible((void *) result[dim], ngroups, sizeof(SortItem),
|
qsort_interruptible(result[dim], ngroups, sizeof(SortItem),
|
||||||
sort_item_compare, ssup);
|
sort_item_compare, ssup);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -489,7 +489,7 @@ ndistinct_for_combination(double totalrows, StatsBuildData *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We can sort the array now ... */
|
/* We can sort the array now ... */
|
||||||
qsort_interruptible((void *) items, numrows, sizeof(SortItem),
|
qsort_interruptible(items, numrows, sizeof(SortItem),
|
||||||
multi_sort_compare, mss);
|
multi_sort_compare, mss);
|
||||||
|
|
||||||
/* ... and count the number of distinct combinations */
|
/* ... and count the number of distinct combinations */
|
||||||
|
@ -2394,7 +2394,7 @@ GetSnapshotData(Snapshot snapshot)
|
|||||||
pg_read_barrier(); /* pairs with GetNewTransactionId */
|
pg_read_barrier(); /* pairs with GetNewTransactionId */
|
||||||
|
|
||||||
memcpy(snapshot->subxip + subcount,
|
memcpy(snapshot->subxip + subcount,
|
||||||
(void *) proc->subxids.xids,
|
proc->subxids.xids,
|
||||||
nsubxids * sizeof(TransactionId));
|
nsubxids * sizeof(TransactionId));
|
||||||
subcount += nsubxids;
|
subcount += nsubxids;
|
||||||
}
|
}
|
||||||
@ -2846,7 +2846,7 @@ GetRunningTransactionData(void)
|
|||||||
/* barrier not really required, as XidGenLock is held, but ... */
|
/* barrier not really required, as XidGenLock is held, but ... */
|
||||||
pg_read_barrier(); /* pairs with GetNewTransactionId */
|
pg_read_barrier(); /* pairs with GetNewTransactionId */
|
||||||
|
|
||||||
memcpy(&xids[count], (void *) proc->subxids.xids,
|
memcpy(&xids[count], proc->subxids.xids,
|
||||||
nsubxids * sizeof(TransactionId));
|
nsubxids * sizeof(TransactionId));
|
||||||
count += nsubxids;
|
count += nsubxids;
|
||||||
subcount += nsubxids;
|
subcount += nsubxids;
|
||||||
|
@ -695,7 +695,7 @@ NIAddAffix(IspellDict *Conf, const char *flag, char flagflags, const char *mask,
|
|||||||
if (Conf->maffixes)
|
if (Conf->maffixes)
|
||||||
{
|
{
|
||||||
Conf->maffixes *= 2;
|
Conf->maffixes *= 2;
|
||||||
Conf->Affix = (AFFIX *) repalloc((void *) Conf->Affix, Conf->maffixes * sizeof(AFFIX));
|
Conf->Affix = (AFFIX *) repalloc(Conf->Affix, Conf->maffixes * sizeof(AFFIX));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1116,7 +1116,7 @@ addCompoundAffixFlagValue(IspellDict *Conf, char *s, uint32 val)
|
|||||||
{
|
{
|
||||||
Conf->mCompoundAffixFlag *= 2;
|
Conf->mCompoundAffixFlag *= 2;
|
||||||
Conf->CompoundAffixFlags = (CompoundAffixFlag *)
|
Conf->CompoundAffixFlags = (CompoundAffixFlag *)
|
||||||
repalloc((void *) Conf->CompoundAffixFlags,
|
repalloc(Conf->CompoundAffixFlags,
|
||||||
Conf->mCompoundAffixFlag * sizeof(CompoundAffixFlag));
|
Conf->mCompoundAffixFlag * sizeof(CompoundAffixFlag));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1158,7 +1158,7 @@ getCompoundAffixFlagValue(IspellDict *Conf, char *s)
|
|||||||
setCompoundAffixFlagValue(Conf, &key, sflag, 0);
|
setCompoundAffixFlagValue(Conf, &key, sflag, 0);
|
||||||
|
|
||||||
found = (CompoundAffixFlag *)
|
found = (CompoundAffixFlag *)
|
||||||
bsearch(&key, (void *) Conf->CompoundAffixFlags,
|
bsearch(&key, Conf->CompoundAffixFlags,
|
||||||
Conf->nCompoundAffixFlag, sizeof(CompoundAffixFlag),
|
Conf->nCompoundAffixFlag, sizeof(CompoundAffixFlag),
|
||||||
cmpcmdflag);
|
cmpcmdflag);
|
||||||
if (found != NULL)
|
if (found != NULL)
|
||||||
@ -1305,7 +1305,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
|
|||||||
tsearch_readline_end(&trst);
|
tsearch_readline_end(&trst);
|
||||||
|
|
||||||
if (Conf->nCompoundAffixFlag > 1)
|
if (Conf->nCompoundAffixFlag > 1)
|
||||||
qsort((void *) Conf->CompoundAffixFlags, Conf->nCompoundAffixFlag,
|
qsort(Conf->CompoundAffixFlags, Conf->nCompoundAffixFlag,
|
||||||
sizeof(CompoundAffixFlag), cmpcmdflag);
|
sizeof(CompoundAffixFlag), cmpcmdflag);
|
||||||
|
|
||||||
if (!tsearch_readline_begin(&trst, filename))
|
if (!tsearch_readline_begin(&trst, filename))
|
||||||
@ -1789,7 +1789,7 @@ NISortDictionary(IspellDict *Conf)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Count the number of different flags used in the dictionary */
|
/* Count the number of different flags used in the dictionary */
|
||||||
qsort((void *) Conf->Spell, Conf->nspell, sizeof(SPELL *),
|
qsort(Conf->Spell, Conf->nspell, sizeof(SPELL *),
|
||||||
cmpspellaffix);
|
cmpspellaffix);
|
||||||
|
|
||||||
naffix = 0;
|
naffix = 0;
|
||||||
@ -1827,7 +1827,7 @@ NISortDictionary(IspellDict *Conf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Start build a prefix tree */
|
/* Start build a prefix tree */
|
||||||
qsort((void *) Conf->Spell, Conf->nspell, sizeof(SPELL *), cmpspell);
|
qsort(Conf->Spell, Conf->nspell, sizeof(SPELL *), cmpspell);
|
||||||
Conf->Dictionary = mkSPNode(Conf, 0, Conf->nspell, 0);
|
Conf->Dictionary = mkSPNode(Conf, 0, Conf->nspell, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2001,7 +2001,7 @@ NISortAffixes(IspellDict *Conf)
|
|||||||
|
|
||||||
/* Store compound affixes in the Conf->CompoundAffix array */
|
/* Store compound affixes in the Conf->CompoundAffix array */
|
||||||
if (Conf->naffixes > 1)
|
if (Conf->naffixes > 1)
|
||||||
qsort((void *) Conf->Affix, Conf->naffixes, sizeof(AFFIX), cmpaffix);
|
qsort(Conf->Affix, Conf->naffixes, sizeof(AFFIX), cmpaffix);
|
||||||
Conf->CompoundAffix = ptr = (CMPDAffix *) palloc(sizeof(CMPDAffix) * Conf->naffixes);
|
Conf->CompoundAffix = ptr = (CMPDAffix *) palloc(sizeof(CMPDAffix) * Conf->naffixes);
|
||||||
ptr->affix = NULL;
|
ptr->affix = NULL;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ uniqueWORD(ParsedWord *a, int32 l)
|
|||||||
/*
|
/*
|
||||||
* Sort words with its positions
|
* Sort words with its positions
|
||||||
*/
|
*/
|
||||||
qsort((void *) a, l, sizeof(ParsedWord), compareWORD);
|
qsort(a, l, sizeof(ParsedWord), compareWORD);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize first word and its first position
|
* Initialize first word and its first position
|
||||||
|
@ -410,7 +410,7 @@ parsetext(Oid cfgId, ParsedText *prs, char *buf, int buflen)
|
|||||||
if (prs->curwords == prs->lenwords)
|
if (prs->curwords == prs->lenwords)
|
||||||
{
|
{
|
||||||
prs->lenwords *= 2;
|
prs->lenwords *= 2;
|
||||||
prs->words = (ParsedWord *) repalloc((void *) prs->words, prs->lenwords * sizeof(ParsedWord));
|
prs->words = (ParsedWord *) repalloc(prs->words, prs->lenwords * sizeof(ParsedWord));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ptr->flags & TSL_ADDPOS)
|
if (ptr->flags & TSL_ADDPOS)
|
||||||
@ -442,7 +442,7 @@ hladdword(HeadlineParsedText *prs, char *buf, int buflen, int type)
|
|||||||
if (prs->curwords >= prs->lenwords)
|
if (prs->curwords >= prs->lenwords)
|
||||||
{
|
{
|
||||||
prs->lenwords *= 2;
|
prs->lenwords *= 2;
|
||||||
prs->words = (HeadlineWordEntry *) repalloc((void *) prs->words, prs->lenwords * sizeof(HeadlineWordEntry));
|
prs->words = (HeadlineWordEntry *) repalloc(prs->words, prs->lenwords * sizeof(HeadlineWordEntry));
|
||||||
}
|
}
|
||||||
memset(&(prs->words[prs->curwords]), 0, sizeof(HeadlineWordEntry));
|
memset(&(prs->words[prs->curwords]), 0, sizeof(HeadlineWordEntry));
|
||||||
prs->words[prs->curwords].type = (uint8) type;
|
prs->words[prs->curwords].type = (uint8) type;
|
||||||
@ -470,7 +470,7 @@ hlfinditem(HeadlineParsedText *prs, TSQuery query, int32 pos, char *buf, int buf
|
|||||||
while (prs->curwords + query->size >= prs->lenwords)
|
while (prs->curwords + query->size >= prs->lenwords)
|
||||||
{
|
{
|
||||||
prs->lenwords *= 2;
|
prs->lenwords *= 2;
|
||||||
prs->words = (HeadlineWordEntry *) repalloc((void *) prs->words, prs->lenwords * sizeof(HeadlineWordEntry));
|
prs->words = (HeadlineWordEntry *) repalloc(prs->words, prs->lenwords * sizeof(HeadlineWordEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
word = &(prs->words[prs->curwords - 1]);
|
word = &(prs->words[prs->curwords - 1]);
|
||||||
|
@ -109,8 +109,7 @@ readstoplist(const char *fname, StopList *s, char *(*wordop) (const char *))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
reallen *= 2;
|
reallen *= 2;
|
||||||
stop = (char **) repalloc((void *) stop,
|
stop = (char **) repalloc(stop, sizeof(char *) * reallen);
|
||||||
sizeof(char *) * reallen);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ makesign(BITVECP sign, SignTSVector *a, int siglen)
|
|||||||
len = ARRNELEM(a);
|
len = ARRNELEM(a);
|
||||||
int32 *ptr = GETARR(a);
|
int32 *ptr = GETARR(a);
|
||||||
|
|
||||||
MemSet((void *) sign, 0, siglen);
|
MemSet(sign, 0, siglen);
|
||||||
for (k = 0; k < len; k++)
|
for (k = 0; k < len; k++)
|
||||||
HASH(sign, ptr[k], siglen);
|
HASH(sign, ptr[k], siglen);
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ gtsvector_compress(PG_FUNCTION_ARGS)
|
|||||||
* val->size
|
* val->size
|
||||||
*/
|
*/
|
||||||
len = CALCGTSIZE(ARRKEY, len);
|
len = CALCGTSIZE(ARRKEY, len);
|
||||||
res = (SignTSVector *) repalloc((void *) res, len);
|
res = (SignTSVector *) repalloc(res, len);
|
||||||
SET_VARSIZE(res, len);
|
SET_VARSIZE(res, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ fillcache(CACHESIGN *item, SignTSVector *key, int siglen)
|
|||||||
else if (ISALLTRUE(key))
|
else if (ISALLTRUE(key))
|
||||||
item->allistrue = true;
|
item->allistrue = true;
|
||||||
else
|
else
|
||||||
memcpy((void *) item->sign, (void *) GETSIGN(key), siglen);
|
memcpy(item->sign, GETSIGN(key), siglen);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
|
#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
|
||||||
@ -704,7 +704,7 @@ gtsvector_picksplit(PG_FUNCTION_ARGS)
|
|||||||
size_beta = hemdistcache(&(cache[seed_2]), &(cache[j]), siglen);
|
size_beta = hemdistcache(&(cache[seed_2]), &(cache[j]), siglen);
|
||||||
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
||||||
}
|
}
|
||||||
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
qsort(costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
||||||
|
|
||||||
for (k = 0; k < maxoff; k++)
|
for (k = 0; k < maxoff; k++)
|
||||||
{
|
{
|
||||||
@ -755,7 +755,7 @@ gtsvector_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (ISALLTRUE(datum_l) || cache[j].allistrue)
|
if (ISALLTRUE(datum_l) || cache[j].allistrue)
|
||||||
{
|
{
|
||||||
if (!ISALLTRUE(datum_l))
|
if (!ISALLTRUE(datum_l))
|
||||||
memset((void *) GETSIGN(datum_l), 0xff, siglen);
|
memset(GETSIGN(datum_l), 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -771,7 +771,7 @@ gtsvector_picksplit(PG_FUNCTION_ARGS)
|
|||||||
if (ISALLTRUE(datum_r) || cache[j].allistrue)
|
if (ISALLTRUE(datum_r) || cache[j].allistrue)
|
||||||
{
|
{
|
||||||
if (!ISALLTRUE(datum_r))
|
if (!ISALLTRUE(datum_r))
|
||||||
memset((void *) GETSIGN(datum_r), 0xff, siglen);
|
memset(GETSIGN(datum_r), 0xff, siglen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -602,10 +602,10 @@ pushValue(TSQueryParserState state, char *strval, int lenval, int16 weight, bool
|
|||||||
int used = state->curop - state->op;
|
int used = state->curop - state->op;
|
||||||
|
|
||||||
state->lenop *= 2;
|
state->lenop *= 2;
|
||||||
state->op = (char *) repalloc((void *) state->op, state->lenop);
|
state->op = (char *) repalloc(state->op, state->lenop);
|
||||||
state->curop = state->op + used;
|
state->curop = state->op + used;
|
||||||
}
|
}
|
||||||
memcpy((void *) state->curop, (void *) strval, lenval);
|
memcpy(state->curop, strval, lenval);
|
||||||
state->curop += lenval;
|
state->curop += lenval;
|
||||||
*(state->curop) = '\0';
|
*(state->curop) = '\0';
|
||||||
state->curop++;
|
state->curop++;
|
||||||
@ -924,7 +924,7 @@ parse_tsquery(char *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy all the operand strings to TSQuery */
|
/* Copy all the operand strings to TSQuery */
|
||||||
memcpy((void *) GETOPERAND(query), (void *) state.op, state.sumlen);
|
memcpy(GETOPERAND(query), state.op, state.sumlen);
|
||||||
pfree(state.op);
|
pfree(state.op);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -67,9 +67,9 @@ plainnode(PLAINTREE *state, NODE *node)
|
|||||||
if (state->cur == state->len)
|
if (state->cur == state->len)
|
||||||
{
|
{
|
||||||
state->len *= 2;
|
state->len *= 2;
|
||||||
state->ptr = (QueryItem *) repalloc((void *) state->ptr, state->len * sizeof(QueryItem));
|
state->ptr = (QueryItem *) repalloc(state->ptr, state->len * sizeof(QueryItem));
|
||||||
}
|
}
|
||||||
memcpy((void *) &(state->ptr[state->cur]), (void *) node->valnode, sizeof(QueryItem));
|
memcpy(&(state->ptr[state->cur]), node->valnode, sizeof(QueryItem));
|
||||||
if (node->valnode->type == QI_VAL)
|
if (node->valnode->type == QI_VAL)
|
||||||
state->cur++;
|
state->cur++;
|
||||||
else if (node->valnode->qoperator.oper == OP_NOT)
|
else if (node->valnode->qoperator.oper == OP_NOT)
|
||||||
|
@ -222,7 +222,7 @@ gtsquery_picksplit(PG_FUNCTION_ARGS)
|
|||||||
size_beta = hemdist(GETENTRY(entryvec, seed_2), GETENTRY(entryvec, j));
|
size_beta = hemdist(GETENTRY(entryvec, seed_2), GETENTRY(entryvec, j));
|
||||||
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
costvector[j - 1].cost = abs(size_alpha - size_beta);
|
||||||
}
|
}
|
||||||
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
qsort(costvector, maxoff, sizeof(SPLITCOST), comparecost);
|
||||||
|
|
||||||
for (k = 0; k < maxoff; k++)
|
for (k = 0; k < maxoff; k++)
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,7 @@ QTNSort(QTNode *in)
|
|||||||
for (i = 0; i < in->nchild; i++)
|
for (i = 0; i < in->nchild; i++)
|
||||||
QTNSort(in->child[i]);
|
QTNSort(in->child[i]);
|
||||||
if (in->nchild > 1 && in->valnode->qoperator.oper != OP_PHRASE)
|
if (in->nchild > 1 && in->valnode->qoperator.oper != OP_PHRASE)
|
||||||
qsort((void *) in->child, in->nchild, sizeof(QTNode *), cmpQTN);
|
qsort(in->child, in->nchild, sizeof(QTNode *), cmpQTN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -176,7 +176,7 @@ SortAndUniqItems(TSQuery q, int *size)
|
|||||||
if (*size < 2)
|
if (*size < 2)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
qsort_arg(res, *size, sizeof(QueryOperand *), compareQueryOperand, (void *) operand);
|
qsort_arg(res, *size, sizeof(QueryOperand *), compareQueryOperand, operand);
|
||||||
|
|
||||||
ptr = res + 1;
|
ptr = res + 1;
|
||||||
prevptr = res;
|
prevptr = res;
|
||||||
@ -804,7 +804,7 @@ get_docrep(TSVector txt, QueryRepresentation *qr, int *doclen)
|
|||||||
/*
|
/*
|
||||||
* Sort representation in ascending order by pos and entry
|
* Sort representation in ascending order by pos and entry
|
||||||
*/
|
*/
|
||||||
qsort((void *) doc, cur, sizeof(DocRepresentation), compareDocR);
|
qsort(doc, cur, sizeof(DocRepresentation), compareDocR);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Join QueryItem per WordEntry and it's position
|
* Join QueryItem per WordEntry and it's position
|
||||||
|
@ -58,7 +58,7 @@ uniquePos(WordEntryPos *a, int l)
|
|||||||
if (l <= 1)
|
if (l <= 1)
|
||||||
return l;
|
return l;
|
||||||
|
|
||||||
qsort((void *) a, l, sizeof(WordEntryPos), compareWordEntryPos);
|
qsort(a, l, sizeof(WordEntryPos), compareWordEntryPos);
|
||||||
|
|
||||||
res = a;
|
res = a;
|
||||||
ptr = a + 1;
|
ptr = a + 1;
|
||||||
@ -107,8 +107,7 @@ uniqueentry(WordEntryIN *a, int l, char *buf, int *outbuflen)
|
|||||||
Assert(l >= 1);
|
Assert(l >= 1);
|
||||||
|
|
||||||
if (l > 1)
|
if (l > 1)
|
||||||
qsort_arg((void *) a, l, sizeof(WordEntryIN), compareentry,
|
qsort_arg(a, l, sizeof(WordEntryIN), compareentry, buf);
|
||||||
(void *) buf);
|
|
||||||
|
|
||||||
buflen = 0;
|
buflen = 0;
|
||||||
res = a;
|
res = a;
|
||||||
@ -232,19 +231,19 @@ tsvectorin(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
arrlen *= 2;
|
arrlen *= 2;
|
||||||
arr = (WordEntryIN *)
|
arr = (WordEntryIN *)
|
||||||
repalloc((void *) arr, sizeof(WordEntryIN) * arrlen);
|
repalloc(arr, sizeof(WordEntryIN) * arrlen);
|
||||||
}
|
}
|
||||||
while ((cur - tmpbuf) + toklen >= buflen)
|
while ((cur - tmpbuf) + toklen >= buflen)
|
||||||
{
|
{
|
||||||
int dist = cur - tmpbuf;
|
int dist = cur - tmpbuf;
|
||||||
|
|
||||||
buflen *= 2;
|
buflen *= 2;
|
||||||
tmpbuf = (char *) repalloc((void *) tmpbuf, buflen);
|
tmpbuf = (char *) repalloc(tmpbuf, buflen);
|
||||||
cur = tmpbuf + dist;
|
cur = tmpbuf + dist;
|
||||||
}
|
}
|
||||||
arr[len].entry.len = toklen;
|
arr[len].entry.len = toklen;
|
||||||
arr[len].entry.pos = cur - tmpbuf;
|
arr[len].entry.pos = cur - tmpbuf;
|
||||||
memcpy((void *) cur, (void *) token, toklen);
|
memcpy(cur, token, toklen);
|
||||||
cur += toklen;
|
cur += toklen;
|
||||||
|
|
||||||
if (poslen != 0)
|
if (poslen != 0)
|
||||||
@ -552,8 +551,8 @@ tsvectorrecv(PG_FUNCTION_ARGS)
|
|||||||
SET_VARSIZE(vec, hdrlen + datalen);
|
SET_VARSIZE(vec, hdrlen + datalen);
|
||||||
|
|
||||||
if (needSort)
|
if (needSort)
|
||||||
qsort_arg((void *) ARRPTR(vec), vec->size, sizeof(WordEntry),
|
qsort_arg(ARRPTR(vec), vec->size, sizeof(WordEntry),
|
||||||
compareentry, (void *) STRPTR(vec));
|
compareentry, STRPTR(vec));
|
||||||
|
|
||||||
PG_RETURN_TSVECTOR(vec);
|
PG_RETURN_TSVECTOR(vec);
|
||||||
}
|
}
|
||||||
|
@ -1736,7 +1736,7 @@ pgpipe(int handles[2])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((void *) &serv_addr, 0, sizeof(serv_addr));
|
memset(&serv_addr, 0, sizeof(serv_addr));
|
||||||
serv_addr.sin_family = AF_INET;
|
serv_addr.sin_family = AF_INET;
|
||||||
serv_addr.sin_port = pg_hton16(0);
|
serv_addr.sin_port = pg_hton16(0);
|
||||||
serv_addr.sin_addr.s_addr = pg_hton32(INADDR_LOOPBACK);
|
serv_addr.sin_addr.s_addr = pg_hton32(INADDR_LOOPBACK);
|
||||||
|
@ -2363,8 +2363,7 @@ WriteDataChunks(ArchiveHandle *AH, ParallelState *pstate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ntes > 1)
|
if (ntes > 1)
|
||||||
qsort((void *) tes, ntes, sizeof(TocEntry *),
|
qsort(tes, ntes, sizeof(TocEntry *), TocEntrySizeCompare);
|
||||||
TocEntrySizeCompare);
|
|
||||||
|
|
||||||
for (int i = 0; i < ntes; i++)
|
for (int i = 0; i < ntes; i++)
|
||||||
DispatchJobForTocEntry(AH, pstate, tes[i], ACT_DUMP,
|
DispatchJobForTocEntry(AH, pstate, tes[i], ACT_DUMP,
|
||||||
|
@ -186,7 +186,7 @@ void
|
|||||||
sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs)
|
sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs)
|
||||||
{
|
{
|
||||||
if (numObjs > 1)
|
if (numObjs > 1)
|
||||||
qsort((void *) objs, numObjs, sizeof(DumpableObject *),
|
qsort(objs, numObjs, sizeof(DumpableObject *),
|
||||||
DOTypeNameCompare);
|
DOTypeNameCompare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ check_loadable_libraries(void)
|
|||||||
* consistent order, which is important for reproducible behavior if one
|
* consistent order, which is important for reproducible behavior if one
|
||||||
* library depends on another.
|
* library depends on another.
|
||||||
*/
|
*/
|
||||||
qsort((void *) os_info.libraries, os_info.num_libraries,
|
qsort(os_info.libraries, os_info.num_libraries,
|
||||||
sizeof(LibraryInfo), library_name_compare);
|
sizeof(LibraryInfo), library_name_compare);
|
||||||
|
|
||||||
for (libnum = 0; libnum < os_info.num_libraries; libnum++)
|
for (libnum = 0; libnum < os_info.num_libraries; libnum++)
|
||||||
|
@ -1604,15 +1604,15 @@ lookupVariable(Variables *variables, char *name)
|
|||||||
/* Sort if we have to */
|
/* Sort if we have to */
|
||||||
if (!variables->vars_sorted)
|
if (!variables->vars_sorted)
|
||||||
{
|
{
|
||||||
qsort((void *) variables->vars, variables->nvars, sizeof(Variable),
|
qsort(variables->vars, variables->nvars, sizeof(Variable),
|
||||||
compareVariableNames);
|
compareVariableNames);
|
||||||
variables->vars_sorted = true;
|
variables->vars_sorted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we can search */
|
/* Now we can search */
|
||||||
key.name = name;
|
key.name = name;
|
||||||
return (Variable *) bsearch((void *) &key,
|
return (Variable *) bsearch(&key,
|
||||||
(void *) variables->vars,
|
variables->vars,
|
||||||
variables->nvars,
|
variables->nvars,
|
||||||
sizeof(Variable),
|
sizeof(Variable),
|
||||||
compareVariableNames);
|
compareVariableNames);
|
||||||
|
@ -78,8 +78,8 @@ copytext(PG_FUNCTION_ARGS)
|
|||||||
* VARDATA is a pointer to the data region of the new struct. The source
|
* VARDATA is a pointer to the data region of the new struct. The source
|
||||||
* could be a short datum, so retrieve its data through VARDATA_ANY.
|
* could be a short datum, so retrieve its data through VARDATA_ANY.
|
||||||
*/
|
*/
|
||||||
memcpy((void *) VARDATA(new_t), /* destination */
|
memcpy(VARDATA(new_t), /* destination */
|
||||||
(void *) VARDATA_ANY(t), /* source */
|
VARDATA_ANY(t), /* source */
|
||||||
VARSIZE_ANY_EXHDR(t)); /* how many bytes */
|
VARSIZE_ANY_EXHDR(t)); /* how many bytes */
|
||||||
PG_RETURN_TEXT_P(new_t);
|
PG_RETURN_TEXT_P(new_t);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user