mirror of
https://github.com/postgres/postgres.git
synced 2025-10-24 01:29:19 +03:00
Remove various unnecessary (char *) casts
Remove a number of (char *) casts that are unnecessary. Or in some cases, rewrite the code to make the purpose of the cast clearer. 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:
@@ -198,7 +198,7 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va
|
||||
case ECPGt_char:
|
||||
case ECPGt_unsigned_char:
|
||||
case ECPGt_string:
|
||||
strncpy((char *) var, value, varcharsize);
|
||||
strncpy(var, value, varcharsize);
|
||||
break;
|
||||
case ECPGt_varchar:
|
||||
{
|
||||
@@ -597,7 +597,7 @@ set_desc_attr(struct descriptor_item *desc_item, struct variable *var,
|
||||
}
|
||||
|
||||
ecpg_free(desc_item->data); /* free() takes care of a potential NULL value */
|
||||
desc_item->data = (char *) tobeinserted;
|
||||
desc_item->data = tobeinserted;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia
|
||||
isarray = ECPG_ARRAY_NONE;
|
||||
else
|
||||
{
|
||||
isarray = (atoi((char *) PQgetvalue(query, 0, 0)) == -1) ? ECPG_ARRAY_ARRAY : ECPG_ARRAY_VECTOR;
|
||||
isarray = (atoi(PQgetvalue(query, 0, 0)) == -1) ? ECPG_ARRAY_ARRAY : ECPG_ARRAY_VECTOR;
|
||||
if (ecpg_dynamic_type(type) == SQL3_CHARACTER ||
|
||||
ecpg_dynamic_type(type) == SQL3_CHARACTER_VARYING)
|
||||
{
|
||||
|
||||
@@ -232,7 +232,7 @@ get_str_from_var(numeric *var, int dscale)
|
||||
|
||||
if (var->sign == NUMERIC_NAN)
|
||||
{
|
||||
str = (char *) pgtypes_alloc(4);
|
||||
str = pgtypes_alloc(4);
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
sprintf(str, "NaN");
|
||||
@@ -269,7 +269,7 @@ get_str_from_var(numeric *var, int dscale)
|
||||
/*
|
||||
* Allocate space for the result
|
||||
*/
|
||||
if ((str = (char *) pgtypes_alloc(Max(0, dscale) + Max(0, var->weight) + 4)) == NULL)
|
||||
if ((str = pgtypes_alloc(Max(0, dscale) + Max(0, var->weight) + 4)) == NULL)
|
||||
return NULL;
|
||||
cp = str;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user