Skip to content

Commit 7f798ac

Browse files
committed
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
1 parent 97525bc commit 7f798ac

File tree

158 files changed

+491
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+491
-550
lines changed

contrib/amcheck/verify_nbtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ bt_check_every_level(Relation rel, Relation heaprel, bool heapkeyspace,
719719
RelationGetRelationName(state->heaprel));
720720

721721
table_index_build_scan(state->heaprel, state->rel, indexinfo, true, false,
722-
bt_tuple_present_callback, (void *) state, scan);
722+
bt_tuple_present_callback, state, scan);
723723

724724
ereport(DEBUG1,
725725
(errmsg_internal("finished verifying presence of " INT64_FORMAT " tuples from table \"%s\" with bitset %.2f%% set",

contrib/bloom/blinsert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ blbuild(Relation heap, Relation index, IndexInfo *indexInfo)
139139

140140
/* Do the heap scan */
141141
reltuples = table_index_build_scan(heap, index, indexInfo, true, true,
142-
bloomBuildCallback, (void *) &buildstate,
142+
bloomBuildCallback, &buildstate,
143143
NULL);
144144

145145
/* Flush last page if needed (it will be, unless heap was empty) */

contrib/bloom/blutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ initBloomState(BloomState *state, Relation index)
199199

200200
UnlockReleaseBuffer(buffer);
201201

202-
index->rd_amcache = (void *) opts;
202+
index->rd_amcache = opts;
203203
}
204204

205205
memcpy(&state->opts, index->rd_amcache, sizeof(state->opts));

contrib/btree_gist/btree_bit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Datum
136136
gbt_bit_consistent(PG_FUNCTION_ARGS)
137137
{
138138
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
139-
void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1));
139+
void *query = DatumGetByteaP(PG_GETARG_DATUM(1));
140140
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
141141

142142
/* Oid subtype = PG_GETARG_OID(3); */

contrib/btree_gist/btree_bool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ gbt_bool_consistent(PG_FUNCTION_ARGS)
120120
key.lower = (GBT_NUMKEY *) &kkk->lower;
121121
key.upper = (GBT_NUMKEY *) &kkk->upper;
122122

123-
PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
123+
PG_RETURN_BOOL(gbt_num_consistent(&key, &query, &strategy,
124124
GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
125125
}
126126

@@ -132,7 +132,7 @@ gbt_bool_union(PG_FUNCTION_ARGS)
132132
void *out = palloc(sizeof(boolKEY));
133133

134134
*(int *) PG_GETARG_POINTER(1) = sizeof(boolKEY);
135-
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
135+
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
136136
}
137137

138138

contrib/btree_gist/btree_bytea.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Datum
104104
gbt_bytea_consistent(PG_FUNCTION_ARGS)
105105
{
106106
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
107-
void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1));
107+
void *query = DatumGetByteaP(PG_GETARG_DATUM(1));
108108
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
109109

110110
/* Oid subtype = PG_GETARG_OID(3); */

contrib/btree_gist/btree_cash.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ gbt_cash_consistent(PG_FUNCTION_ARGS)
150150
key.lower = (GBT_NUMKEY *) &kkk->lower;
151151
key.upper = (GBT_NUMKEY *) &kkk->upper;
152152

153-
PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
153+
PG_RETURN_BOOL(gbt_num_consistent(&key, &query, &strategy,
154154
GIST_LEAF(entry), &tinfo,
155155
fcinfo->flinfo));
156156
}
@@ -169,7 +169,7 @@ gbt_cash_distance(PG_FUNCTION_ARGS)
169169
key.lower = (GBT_NUMKEY *) &kkk->lower;
170170
key.upper = (GBT_NUMKEY *) &kkk->upper;
171171

172-
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
172+
PG_RETURN_FLOAT8(gbt_num_distance(&key, &query, GIST_LEAF(entry),
173173
&tinfo, fcinfo->flinfo));
174174
}
175175

@@ -181,7 +181,7 @@ gbt_cash_union(PG_FUNCTION_ARGS)
181181
void *out = palloc(sizeof(cashKEY));
182182

183183
*(int *) PG_GETARG_POINTER(1) = sizeof(cashKEY);
184-
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
184+
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
185185
}
186186

187187

contrib/btree_gist/btree_date.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ gbt_date_consistent(PG_FUNCTION_ARGS)
167167
key.lower = (GBT_NUMKEY *) &kkk->lower;
168168
key.upper = (GBT_NUMKEY *) &kkk->upper;
169169

170-
PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
170+
PG_RETURN_BOOL(gbt_num_consistent(&key, &query, &strategy,
171171
GIST_LEAF(entry), &tinfo,
172172
fcinfo->flinfo));
173173
}
@@ -186,7 +186,7 @@ gbt_date_distance(PG_FUNCTION_ARGS)
186186
key.lower = (GBT_NUMKEY *) &kkk->lower;
187187
key.upper = (GBT_NUMKEY *) &kkk->upper;
188188

189-
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
189+
PG_RETURN_FLOAT8(gbt_num_distance(&key, &query, GIST_LEAF(entry),
190190
&tinfo, fcinfo->flinfo));
191191
}
192192

@@ -198,7 +198,7 @@ gbt_date_union(PG_FUNCTION_ARGS)
198198
void *out = palloc(sizeof(dateKEY));
199199

200200
*(int *) PG_GETARG_POINTER(1) = sizeof(dateKEY);
201-
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
201+
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
202202
}
203203

204204

contrib/btree_gist/btree_enum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ gbt_enum_consistent(PG_FUNCTION_ARGS)
137137
key.lower = (GBT_NUMKEY *) &kkk->lower;
138138
key.upper = (GBT_NUMKEY *) &kkk->upper;
139139

140-
PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
140+
PG_RETURN_BOOL(gbt_num_consistent(&key, &query, &strategy,
141141
GIST_LEAF(entry), &tinfo,
142142
fcinfo->flinfo));
143143
}
@@ -149,7 +149,7 @@ gbt_enum_union(PG_FUNCTION_ARGS)
149149
void *out = palloc(sizeof(oidKEY));
150150

151151
*(int *) PG_GETARG_POINTER(1) = sizeof(oidKEY);
152-
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
152+
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
153153
}
154154

155155

contrib/btree_gist/btree_float4.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ gbt_float4_consistent(PG_FUNCTION_ARGS)
145145
key.lower = (GBT_NUMKEY *) &kkk->lower;
146146
key.upper = (GBT_NUMKEY *) &kkk->upper;
147147

148-
PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
148+
PG_RETURN_BOOL(gbt_num_consistent(&key, &query, &strategy,
149149
GIST_LEAF(entry), &tinfo,
150150
fcinfo->flinfo));
151151
}
@@ -164,7 +164,7 @@ gbt_float4_distance(PG_FUNCTION_ARGS)
164164
key.lower = (GBT_NUMKEY *) &kkk->lower;
165165
key.upper = (GBT_NUMKEY *) &kkk->upper;
166166

167-
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
167+
PG_RETURN_FLOAT8(gbt_num_distance(&key, &query, GIST_LEAF(entry),
168168
&tinfo, fcinfo->flinfo));
169169
}
170170

@@ -176,7 +176,7 @@ gbt_float4_union(PG_FUNCTION_ARGS)
176176
void *out = palloc(sizeof(float4KEY));
177177

178178
*(int *) PG_GETARG_POINTER(1) = sizeof(float4KEY);
179-
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
179+
PG_RETURN_POINTER(gbt_num_union(out, entryvec, &tinfo, fcinfo->flinfo));
180180
}
181181

182182

0 commit comments

Comments
 (0)