1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

More unconstify use

Replace casts whose only purpose is to cast away const with the
unconstify() macro.

Discussion: https://www.postgresql.org/message-id/flat/53a28052-f9f3-1808-fed9-460fd43035ab%402ndquadrant.com
This commit is contained in:
Peter Eisentraut
2019-01-29 01:16:24 +01:00
parent cf40dc65b6
commit 37d9916020
25 changed files with 57 additions and 55 deletions

View File

@ -185,10 +185,10 @@ gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_nin
c.upper = &cur[tinfo->size];
/* if out->lower > cur->lower, adopt cur as lower */
if (tinfo->f_gt(o.lower, c.lower, flinfo))
memcpy((void *) o.lower, c.lower, tinfo->size);
memcpy(unconstify(GBT_NUMKEY *, o.lower), c.lower, tinfo->size);
/* if out->upper < cur->upper, adopt cur as upper */
if (tinfo->f_lt(o.upper, c.upper, flinfo))
memcpy((void *) o.upper, c.upper, tinfo->size);
memcpy(unconstify(GBT_NUMKEY *, o.upper), c.upper, tinfo->size);
}
return out;
@ -237,9 +237,9 @@ gbt_num_bin_union(Datum *u, GBT_NUMKEY *e, const gbtree_ninfo *tinfo, FmgrInfo *
ur.lower = &(((GBT_NUMKEY *) DatumGetPointer(*u))[0]);
ur.upper = &(((GBT_NUMKEY *) DatumGetPointer(*u))[tinfo->size]);
if (tinfo->f_gt(ur.lower, rd.lower, flinfo))
memcpy((void *) ur.lower, rd.lower, tinfo->size);
memcpy(unconstify(GBT_NUMKEY *, ur.lower), rd.lower, tinfo->size);
if (tinfo->f_lt(ur.upper, rd.upper, flinfo))
memcpy((void *) ur.upper, rd.upper, tinfo->size);
memcpy(unconstify(GBT_NUMKEY *, ur.upper), rd.upper, tinfo->size);
}
}

View File

@ -2050,7 +2050,7 @@ mp_int_read_cstring(mp_int z, mp_size radix, const char *str, char **end)
MP_SIGN(z) = MP_ZPOS;
if (end != NULL)
*end = (char *) str;
*end = unconstify(char *, str);
/*
* Return a truncation error if the string has unprocessed characters

View File

@ -161,7 +161,7 @@ md5_loop(md5_ctxt *ctxt, const uint8 *input, unsigned len)
md5_calc(ctxt->md5_buf, ctxt);
for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN)
md5_calc((uint8 *) (input + i), ctxt);
md5_calc(unconstify(uint8 *, (input + i)), ctxt);
ctxt->md5_i = len - i;
memmove(ctxt->md5_buf, input + i, ctxt->md5_i);

View File

@ -117,7 +117,7 @@ compress_process(PushFilter *next, void *priv, const uint8 *data, int len)
*/
while (len > 0)
{
st->stream.next_in = (void *) data;
st->stream.next_in = unconstify(uint8 *, data);
st->stream.avail_in = len;
st->stream.next_out = st->buf;
st->stream.avail_out = st->buf_len;