1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-24 01:29:19 +03: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:
Peter Eisentraut
2023-02-07 06:53:05 +01:00
parent d9d7fe68d3
commit aa69541046
52 changed files with 116 additions and 119 deletions

View File

@@ -695,7 +695,7 @@ NIAddAffix(IspellDict *Conf, const char *flag, char flagflags, const char *mask,
if (Conf->maffixes)
{
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
{
@@ -1116,7 +1116,7 @@ addCompoundAffixFlagValue(IspellDict *Conf, char *s, uint32 val)
{
Conf->mCompoundAffixFlag *= 2;
Conf->CompoundAffixFlags = (CompoundAffixFlag *)
repalloc((void *) Conf->CompoundAffixFlags,
repalloc(Conf->CompoundAffixFlags,
Conf->mCompoundAffixFlag * sizeof(CompoundAffixFlag));
}
else
@@ -1158,7 +1158,7 @@ getCompoundAffixFlagValue(IspellDict *Conf, char *s)
setCompoundAffixFlagValue(Conf, &key, sflag, 0);
found = (CompoundAffixFlag *)
bsearch(&key, (void *) Conf->CompoundAffixFlags,
bsearch(&key, Conf->CompoundAffixFlags,
Conf->nCompoundAffixFlag, sizeof(CompoundAffixFlag),
cmpcmdflag);
if (found != NULL)
@@ -1305,7 +1305,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
tsearch_readline_end(&trst);
if (Conf->nCompoundAffixFlag > 1)
qsort((void *) Conf->CompoundAffixFlags, Conf->nCompoundAffixFlag,
qsort(Conf->CompoundAffixFlags, Conf->nCompoundAffixFlag,
sizeof(CompoundAffixFlag), cmpcmdflag);
if (!tsearch_readline_begin(&trst, filename))
@@ -1789,7 +1789,7 @@ NISortDictionary(IspellDict *Conf)
else
{
/* 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);
naffix = 0;
@@ -1827,7 +1827,7 @@ NISortDictionary(IspellDict *Conf)
}
/* 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);
}
@@ -2001,7 +2001,7 @@ NISortAffixes(IspellDict *Conf)
/* Store compound affixes in the Conf->CompoundAffix array */
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);
ptr->affix = NULL;

View File

@@ -97,7 +97,7 @@ uniqueWORD(ParsedWord *a, int32 l)
/*
* 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

View File

@@ -410,7 +410,7 @@ parsetext(Oid cfgId, ParsedText *prs, char *buf, int buflen)
if (prs->curwords == prs->lenwords)
{
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)
@@ -442,7 +442,7 @@ hladdword(HeadlineParsedText *prs, char *buf, int buflen, int type)
if (prs->curwords >= prs->lenwords)
{
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));
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)
{
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]);

View File

@@ -109,8 +109,7 @@ readstoplist(const char *fname, StopList *s, char *(*wordop) (const char *))
else
{
reallen *= 2;
stop = (char **) repalloc((void *) stop,
sizeof(char *) * reallen);
stop = (char **) repalloc(stop, sizeof(char *) * reallen);
}
}