Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit973e9fb

Browse files
committed
Add const qualifiers where they are accidentally cast away
This only produces warnings under -Wcast-qual, but it's more correctand consistent in any case.
1 parent41e3c94 commit973e9fb

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

‎contrib/intarray/_intbig_gist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ typedef struct
332332
staticint
333333
comparecost(constvoid*a,constvoid*b)
334334
{
335-
return ((SPLITCOST*)a)->cost- ((SPLITCOST*)b)->cost;
335+
return ((constSPLITCOST*)a)->cost- ((constSPLITCOST*)b)->cost;
336336
}
337337

338338

‎contrib/ltree/ltree_gist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ static int
275275
treekey_cmp(constvoid*a,constvoid*b)
276276
{
277277
returnltree_compare(
278-
((RIX*)a)->r,
279-
((RIX*)b)->r
278+
((constRIX*)a)->r,
279+
((constRIX*)b)->r
280280
);
281281
}
282282

‎src/backend/access/gist/gistproc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ typedef struct
284284
staticint
285285
interval_cmp_lower(constvoid*i1,constvoid*i2)
286286
{
287-
doublelower1= ((SplitInterval*)i1)->lower,
288-
lower2= ((SplitInterval*)i2)->lower;
287+
doublelower1= ((constSplitInterval*)i1)->lower,
288+
lower2= ((constSplitInterval*)i2)->lower;
289289

290290
if (lower1<lower2)
291291
return-1;
@@ -301,8 +301,8 @@ interval_cmp_lower(const void *i1, const void *i2)
301301
staticint
302302
interval_cmp_upper(constvoid*i1,constvoid*i2)
303303
{
304-
doubleupper1= ((SplitInterval*)i1)->upper,
305-
upper2= ((SplitInterval*)i2)->upper;
304+
doubleupper1= ((constSplitInterval*)i1)->upper,
305+
upper2= ((constSplitInterval*)i2)->upper;
306306

307307
if (upper1<upper2)
308308
return-1;
@@ -455,8 +455,8 @@ box_penalty(BOX *original, BOX *new)
455455
staticint
456456
common_entry_cmp(constvoid*i1,constvoid*i2)
457457
{
458-
doubledelta1= ((CommonEntry*)i1)->delta,
459-
delta2= ((CommonEntry*)i2)->delta;
458+
doubledelta1= ((constCommonEntry*)i1)->delta,
459+
delta2= ((constCommonEntry*)i2)->delta;
460460

461461
if (delta1<delta2)
462462
return-1;

‎src/backend/utils/adt/tsquery_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ QTNodeCompare(QTNode *an, QTNode *bn)
134134
staticint
135135
cmpQTN(constvoid*a,constvoid*b)
136136
{
137-
returnQTNodeCompare(*(QTNode**)a,*(QTNode**)b);
137+
returnQTNodeCompare(*(QTNode*const*)a,*(QTNode*const*)b);
138138
}
139139

140140
void

‎src/backend/utils/adt/xml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ xml_recv(PG_FUNCTION_ARGS)
311311
str=VARDATA(result);
312312
str[nbytes]='\0';
313313

314-
parse_xml_decl((xmlChar*)str,NULL,NULL,&encodingStr,NULL);
314+
parse_xml_decl((constxmlChar*)str,NULL,NULL,&encodingStr,NULL);
315315

316316
/*
317317
* If encoding wasn't explicitly specified in the XML header, treat it as

‎src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3780,8 +3780,8 @@ find_option(const char *name, bool create_placeholders, int elevel)
37803780
staticint
37813781
guc_var_compare(constvoid*a,constvoid*b)
37823782
{
3783-
structconfig_generic*confa=*(structconfig_generic**)a;
3784-
structconfig_generic*confb=*(structconfig_generic**)b;
3783+
conststructconfig_generic*confa=*(structconfig_generic*const*)a;
3784+
conststructconfig_generic*confb=*(structconfig_generic*const*)b;
37853785

37863786
returnguc_name_compare(confa->name,confb->name);
37873787
}

‎src/bin/psql/mbprint.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ pg_wcssize(const unsigned char *pwcs, size_t len, int encoding,
217217

218218
for (;*pwcs&&len>0;pwcs+=chlen)
219219
{
220-
chlen=PQmblen((char*)pwcs,encoding);
220+
chlen=PQmblen((constchar*)pwcs,encoding);
221221
if (len< (size_t)chlen)
222222
break;
223-
w=PQdsplen((char*)pwcs,encoding);
223+
w=PQdsplen((constchar*)pwcs,encoding);
224224

225225
if (chlen==1)/* single-byte char */
226226
{
@@ -298,10 +298,10 @@ pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding,
298298

299299
for (;*pwcs&&len>0;pwcs+=chlen)
300300
{
301-
chlen=PQmblen((char*)pwcs,encoding);
301+
chlen=PQmblen((constchar*)pwcs,encoding);
302302
if (len< (size_t)chlen)
303303
break;
304-
w=PQdsplen((char*)pwcs,encoding);
304+
w=PQdsplen((constchar*)pwcs,encoding);
305305

306306
if (chlen==1)/* single-byte char */
307307
{

‎src/include/c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ typedef NameData *Name;
478478
* PointerIsValid
479479
*True iff pointer is valid.
480480
*/
481-
#definePointerIsValid(pointer) ((void*)(pointer) != NULL)
481+
#definePointerIsValid(pointer) ((constvoid*)(pointer) != NULL)
482482

483483
/*
484484
* PointerIsAligned

‎src/include/utils/pg_crc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef uint32 pg_crc32;
4040
/* Accumulate some (more) bytes into a CRC */
4141
#defineCOMP_CRC32(crc,data,len)\
4242
do { \
43-
unsigned char *__data = (unsigned char *) (data); \
43+
constunsigned char *__data = (constunsigned char *) (data); \
4444
uint32__len = (len); \
4545
\
4646
while (__len-- > 0) \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp