mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Remove unnecessary (char *) casts [string]
Remove (char *) casts around string functions where the arguments or result already have the right type and the cast is useless (or worse, potentially casts away a qualifier, but this doesn't appear to be the case here). Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Discussion: https://www.postgresql.org/message-id/flat/fd1fcedb-3492-4fc8-9e3e-74b97f2db6c7%40eisentraut.org
This commit is contained in:
parent
0bc34ad692
commit
506183bce7
@ -308,13 +308,13 @@ IsVowel(metastring *s, int pos)
|
||||
static int
|
||||
SlavoGermanic(metastring *s)
|
||||
{
|
||||
if ((char *) strstr(s->str, "W"))
|
||||
if (strstr(s->str, "W"))
|
||||
return 1;
|
||||
else if ((char *) strstr(s->str, "K"))
|
||||
else if (strstr(s->str, "K"))
|
||||
return 1;
|
||||
else if ((char *) strstr(s->str, "CZ"))
|
||||
else if (strstr(s->str, "CZ"))
|
||||
return 1;
|
||||
else if ((char *) strstr(s->str, "WITZ"))
|
||||
else if (strstr(s->str, "WITZ"))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -1027,7 +1027,7 @@ fill_my_string_relopt(const char *value, void *ptr)
|
||||
int len = strlen(tmp);
|
||||
|
||||
if (ptr)
|
||||
strcpy((char *) ptr, tmp);
|
||||
strcpy(ptr, tmp);
|
||||
|
||||
pfree(tmp);
|
||||
return len + 1;
|
||||
|
@ -249,8 +249,8 @@ WalReceiverMain(char *startup_data, size_t startup_data_len)
|
||||
|
||||
/* Fetch information required to start streaming */
|
||||
walrcv->ready_to_display = false;
|
||||
strlcpy(conninfo, (char *) walrcv->conninfo, MAXCONNINFO);
|
||||
strlcpy(slotname, (char *) walrcv->slotname, NAMEDATALEN);
|
||||
strlcpy(conninfo, walrcv->conninfo, MAXCONNINFO);
|
||||
strlcpy(slotname, walrcv->slotname, NAMEDATALEN);
|
||||
is_temp_slot = walrcv->is_temp_slot;
|
||||
startpoint = walrcv->receiveStart;
|
||||
startpointTLI = walrcv->receiveStartTLI;
|
||||
@ -317,11 +317,11 @@ WalReceiverMain(char *startup_data, size_t startup_data_len)
|
||||
SpinLockAcquire(&walrcv->mutex);
|
||||
memset(walrcv->conninfo, 0, MAXCONNINFO);
|
||||
if (tmp_conninfo)
|
||||
strlcpy((char *) walrcv->conninfo, tmp_conninfo, MAXCONNINFO);
|
||||
strlcpy(walrcv->conninfo, tmp_conninfo, MAXCONNINFO);
|
||||
|
||||
memset(walrcv->sender_host, 0, NI_MAXHOST);
|
||||
if (sender_host)
|
||||
strlcpy((char *) walrcv->sender_host, sender_host, NI_MAXHOST);
|
||||
strlcpy(walrcv->sender_host, sender_host, NI_MAXHOST);
|
||||
|
||||
walrcv->sender_port = sender_port;
|
||||
walrcv->ready_to_display = true;
|
||||
@ -1434,10 +1434,10 @@ pg_stat_get_wal_receiver(PG_FUNCTION_ARGS)
|
||||
last_receipt_time = WalRcv->lastMsgReceiptTime;
|
||||
latest_end_lsn = WalRcv->latestWalEnd;
|
||||
latest_end_time = WalRcv->latestWalEndTime;
|
||||
strlcpy(slotname, (char *) WalRcv->slotname, sizeof(slotname));
|
||||
strlcpy(sender_host, (char *) WalRcv->sender_host, sizeof(sender_host));
|
||||
strlcpy(slotname, WalRcv->slotname, sizeof(slotname));
|
||||
strlcpy(sender_host, WalRcv->sender_host, sizeof(sender_host));
|
||||
sender_port = WalRcv->sender_port;
|
||||
strlcpy(conninfo, (char *) WalRcv->conninfo, sizeof(conninfo));
|
||||
strlcpy(conninfo, WalRcv->conninfo, sizeof(conninfo));
|
||||
SpinLockRelease(&WalRcv->mutex);
|
||||
|
||||
/*
|
||||
|
@ -267,7 +267,7 @@ RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr, const char *conninfo,
|
||||
walrcv->walRcvState == WALRCV_WAITING);
|
||||
|
||||
if (conninfo != NULL)
|
||||
strlcpy((char *) walrcv->conninfo, conninfo, MAXCONNINFO);
|
||||
strlcpy(walrcv->conninfo, conninfo, MAXCONNINFO);
|
||||
else
|
||||
walrcv->conninfo[0] = '\0';
|
||||
|
||||
@ -279,7 +279,7 @@ RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr, const char *conninfo,
|
||||
*/
|
||||
if (slotname != NULL && slotname[0] != '\0')
|
||||
{
|
||||
strlcpy((char *) walrcv->slotname, slotname, NAMEDATALEN);
|
||||
strlcpy(walrcv->slotname, slotname, NAMEDATALEN);
|
||||
walrcv->is_temp_slot = false;
|
||||
}
|
||||
else
|
||||
|
@ -795,11 +795,11 @@ pgstat_read_current_status(void)
|
||||
* strcpy is safe even if the string is modified concurrently,
|
||||
* because there's always a \0 at the end of the buffer.
|
||||
*/
|
||||
strcpy(localappname, (char *) beentry->st_appname);
|
||||
strcpy(localappname, beentry->st_appname);
|
||||
localentry->backendStatus.st_appname = localappname;
|
||||
strcpy(localclienthostname, (char *) beentry->st_clienthostname);
|
||||
strcpy(localclienthostname, beentry->st_clienthostname);
|
||||
localentry->backendStatus.st_clienthostname = localclienthostname;
|
||||
strcpy(localactivity, (char *) beentry->st_activity_raw);
|
||||
strcpy(localactivity, beentry->st_activity_raw);
|
||||
localentry->backendStatus.st_activity_raw = localactivity;
|
||||
#ifdef USE_SSL
|
||||
if (beentry->st_ssl)
|
||||
|
@ -19,7 +19,7 @@ pgtypes_alloc(long size)
|
||||
char *
|
||||
pgtypes_strdup(const char *str)
|
||||
{
|
||||
char *new = (char *) strdup(str);
|
||||
char *new = strdup(str);
|
||||
|
||||
if (!new)
|
||||
errno = ENOMEM;
|
||||
|
Loading…
x
Reference in New Issue
Block a user