1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-24 01:29:19 +03:00

Remove useless casts to (void *)

Many of them just seem to have been copied around for no real reason.
Their presence causes (small) risks of hiding actual type mismatches
or silently discarding qualifiers

Discussion: https://www.postgresql.org/message-id/flat/461ea37c-8b58-43b4-9736-52884e862820@eisentraut.org
This commit is contained in:
Peter Eisentraut
2024-11-28 08:19:22 +01:00
parent 97525bc5c8
commit 7f798aca1d
158 changed files with 491 additions and 550 deletions

View File

@@ -859,7 +859,7 @@ thesaurus_lexize(PG_FUNCTION_ARGS)
info = NULL; /* word isn't recognized */
}
dstate->private_state = (void *) info;
dstate->private_state = info;
if (!info)
{

View File

@@ -148,7 +148,7 @@ compact_palloc0(IspellDict *Conf, size_t size)
Conf->avail = COMPACT_ALLOC_CHUNK;
}
result = (void *) Conf->firstfree;
result = Conf->firstfree;
Conf->firstfree += size;
Conf->avail -= size;

View File

@@ -142,7 +142,7 @@ tsearch_readline_begin(tsearch_readline_state *stp,
stp->curline = NULL;
/* Setup error traceback support for ereport() */
stp->cb.callback = tsearch_readline_callback;
stp->cb.arg = (void *) stp;
stp->cb.arg = stp;
stp->cb.previous = error_context_stack;
error_context_stack = &stp->cb;
return true;

View File

@@ -366,9 +366,9 @@ parsetext(Oid cfgId, ParsedText *prs, char *buf, int buflen)
cfg = lookup_ts_config_cache(cfgId);
prsobj = lookup_ts_parser_cache(cfg->prsId);
prsdata = (void *) DatumGetPointer(FunctionCall2(&prsobj->prsstart,
PointerGetDatum(buf),
Int32GetDatum(buflen)));
prsdata = DatumGetPointer(FunctionCall2(&prsobj->prsstart,
PointerGetDatum(buf),
Int32GetDatum(buflen)));
LexizeInit(&ldata, cfg);
@@ -552,9 +552,9 @@ hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, char *buf, int bu
cfg = lookup_ts_config_cache(cfgId);
prsobj = lookup_ts_parser_cache(cfg->prsId);
prsdata = (void *) DatumGetPointer(FunctionCall2(&(prsobj->prsstart),
PointerGetDatum(buf),
Int32GetDatum(buflen)));
prsdata = DatumGetPointer(FunctionCall2(&(prsobj->prsstart),
PointerGetDatum(buf),
Int32GetDatum(buflen)));
LexizeInit(&ldata, cfg);

View File

@@ -63,7 +63,7 @@ tt_setup_firstcall(FuncCallContext *funcctx, FunctionCallInfo fcinfo,
/* lextype takes one dummy argument */
st->list = (LexDescr *) DatumGetPointer(OidFunctionCall1(prs->lextypeOid,
(Datum) 0));
funcctx->user_fctx = (void *) st;
funcctx->user_fctx = st;
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
@@ -178,9 +178,9 @@ prs_setup_firstcall(FuncCallContext *funcctx, FunctionCallInfo fcinfo,
st->len = 16;
st->list = (LexemeEntry *) palloc(sizeof(LexemeEntry) * st->len);
prsdata = (void *) DatumGetPointer(FunctionCall2(&prs->prsstart,
PointerGetDatum(VARDATA_ANY(txt)),
Int32GetDatum(VARSIZE_ANY_EXHDR(txt))));
prsdata = DatumGetPointer(FunctionCall2(&prs->prsstart,
PointerGetDatum(VARDATA_ANY(txt)),
Int32GetDatum(VARSIZE_ANY_EXHDR(txt))));
while ((type = DatumGetInt32(FunctionCall3(&prs->prstoken,
PointerGetDatum(prsdata),