mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Convert some casts to unconstify
These casts existed only to cast away a const qualifier. Convert them to unconstify to make that more explicit. Reviewed-by: Rui Zhao <zhaorui126@gmail.com> Discussion: https://www.postgresql.org/message-id/c76b72dd-5736-453a-b698-6968d42e4768%40eisentraut.org
This commit is contained in:
@@ -4312,7 +4312,7 @@ ExecBuildHash32Expr(TupleDesc desc, const TupleTableSlotOps *ops,
|
||||
state->parent = parent;
|
||||
|
||||
/* Insert setup steps as needed. */
|
||||
ExecCreateExprSetupSteps(state, (Node *) hash_exprs);
|
||||
ExecCreateExprSetupSteps(state, unconstify(Node *, (const Node *) hash_exprs));
|
||||
|
||||
/*
|
||||
* Make a place to store intermediate hash values between subsequent
|
||||
|
||||
@@ -420,7 +420,7 @@ ReplicationSlotCreate(const char *name, bool db_specific,
|
||||
errmsg("cannot enable failover for a temporary replication slot"));
|
||||
}
|
||||
|
||||
INJECTION_POINT("replication-slot-create-begin", (char *) name);
|
||||
INJECTION_POINT("replication-slot-create-begin", unconstify(char *, name));
|
||||
|
||||
/*
|
||||
* If some other backend ran this code concurrently with us, we'd likely
|
||||
|
||||
@@ -942,7 +942,7 @@ RegisterShmemCallbacks(const ShmemCallbacks *callbacks)
|
||||
{
|
||||
/* Remember the callbacks for later */
|
||||
registered_shmem_callbacks = lappend(registered_shmem_callbacks,
|
||||
(void *) callbacks);
|
||||
unconstify(ShmemCallbacks *, callbacks));
|
||||
}
|
||||
else
|
||||
elog(ERROR, "cannot request shared memory at this time");
|
||||
|
||||
@@ -1101,7 +1101,7 @@ mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
if (nblocks_this_segment != nblocks)
|
||||
elog(ERROR, "write crosses segment boundary");
|
||||
|
||||
iovcnt = buffers_to_iovec(iov, (void **) buffers, nblocks_this_segment);
|
||||
iovcnt = buffers_to_iovec(iov, unconstify(void **, buffers), nblocks_this_segment);
|
||||
size_this_segment = nblocks_this_segment * BLCKSZ;
|
||||
transferred_this_segment = 0;
|
||||
|
||||
|
||||
@@ -1945,7 +1945,7 @@ pgwin32_message_to_UTF16(const char *str, int len, int *utf16len)
|
||||
*/
|
||||
if (IsTransactionState())
|
||||
{
|
||||
utf8 = (char *) pg_do_encoding_conversion((unsigned char *) str,
|
||||
utf8 = (char *) pg_do_encoding_conversion((unsigned char *) unconstify(char *, str),
|
||||
len,
|
||||
msgenc,
|
||||
PG_UTF8);
|
||||
@@ -1953,7 +1953,7 @@ pgwin32_message_to_UTF16(const char *str, int len, int *utf16len)
|
||||
len = strlen(utf8);
|
||||
}
|
||||
else
|
||||
utf8 = (char *) str;
|
||||
utf8 = unconstify(char *, str);
|
||||
|
||||
utf16 = palloc_array(WCHAR, len + 1);
|
||||
dstlen = MultiByteToWideChar(CP_UTF8, 0, utf8, len, utf16, len);
|
||||
|
||||
@@ -67,7 +67,7 @@ bsearch_arg(const void *key, const void *base0,
|
||||
p = base + (lim >> 1) * size;
|
||||
cmp = (*compar) (key, p, arg);
|
||||
if (cmp == 0)
|
||||
return (void *) p;
|
||||
return unconstify(void *, p);
|
||||
if (cmp > 0)
|
||||
{ /* key > p: move right */
|
||||
base = (const char *) p + size;
|
||||
|
||||
@@ -78,7 +78,7 @@ skip_drive(const char *path)
|
||||
{
|
||||
path += 2;
|
||||
}
|
||||
return (char *) path;
|
||||
return unconstify(char *, path);
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user