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

Commit3b12e68

Browse files
committed
Change argument type of pq_sendbytes from char * to void *
This is a follow-up to1f605b8. Itallows getting rid of further casts at call sites.Reviewed-by: Corey Huinker <corey.huinker@gmail.com>Discussion:https://www.postgresql.org/message-id/783a4edb-84f9-6df2-7470-2ef5ccc6607a@enterprisedb.com
1 parenta8a4482 commit3b12e68

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

‎src/backend/libpq/pqformat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pq_beginmessage_reuse(StringInfo buf, char msgtype)
123123
* --------------------------------
124124
*/
125125
void
126-
pq_sendbytes(StringInfobuf,constchar*data,intdatalen)
126+
pq_sendbytes(StringInfobuf,constvoid*data,intdatalen)
127127
{
128128
/* use variant that maintains a trailing null-byte, out of caution */
129129
appendBinaryStringInfo(buf,data,datalen);

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ array_agg_serialize(PG_FUNCTION_ARGS)
654654
pq_sendbyte(&buf,state->typalign);
655655

656656
/* dnulls */
657-
pq_sendbytes(&buf,(char*)state->dnulls,sizeof(bool)*state->nelems);
657+
pq_sendbytes(&buf,state->dnulls,sizeof(bool)*state->nelems);
658658

659659
/*
660660
* dvalues. By agreement with array_agg_deserialize, when the element
@@ -664,8 +664,7 @@ array_agg_serialize(PG_FUNCTION_ARGS)
664664
* must be sent first).
665665
*/
666666
if (state->typbyval)
667-
pq_sendbytes(&buf, (char*)state->dvalues,
668-
sizeof(Datum)*state->nelems);
667+
pq_sendbytes(&buf,state->dvalues,sizeof(Datum)*state->nelems);
669668
else
670669
{
671670
SerialIOData*iodata;
@@ -1097,7 +1096,7 @@ array_agg_array_serialize(PG_FUNCTION_ARGS)
10971096
if (state->nullbitmap)
10981097
{
10991098
Assert(state->aitems>0);
1100-
pq_sendbytes(&buf,(char*)state->nullbitmap, (state->aitems+7) /8);
1099+
pq_sendbytes(&buf,state->nullbitmap, (state->aitems+7) /8);
11011100
}
11021101

11031102
/* nitems */
@@ -1107,10 +1106,10 @@ array_agg_array_serialize(PG_FUNCTION_ARGS)
11071106
pq_sendint32(&buf,state->ndims);
11081107

11091108
/* dims: XXX should we just send ndims elements? */
1110-
pq_sendbytes(&buf,(char*)state->dims,sizeof(state->dims));
1109+
pq_sendbytes(&buf,state->dims,sizeof(state->dims));
11111110

11121111
/* lbs */
1113-
pq_sendbytes(&buf,(char*)state->lbs,sizeof(state->lbs));
1112+
pq_sendbytes(&buf,state->lbs,sizeof(state->lbs));
11141113

11151114
result=pq_endtypsend(&buf);
11161115

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ uuid_send(PG_FUNCTION_ARGS)
154154
StringInfoDatabuffer;
155155

156156
pq_begintypsend(&buffer);
157-
pq_sendbytes(&buffer,(char*)uuid->data,UUID_LEN);
157+
pq_sendbytes(&buffer,uuid->data,UUID_LEN);
158158
PG_RETURN_BYTEA_P(pq_endtypsend(&buffer));
159159
}
160160

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ varbit_send(PG_FUNCTION_ARGS)
685685

686686
pq_begintypsend(&buf);
687687
pq_sendint32(&buf,VARBITLEN(s));
688-
pq_sendbytes(&buf,(char*)VARBITS(s),VARBITBYTES(s));
688+
pq_sendbytes(&buf,VARBITS(s),VARBITBYTES(s));
689689
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
690690
}
691691

‎src/include/libpq/pqformat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern void pq_beginmessage_reuse(StringInfo buf, char msgtype);
2222
externvoidpq_endmessage(StringInfobuf);
2323
externvoidpq_endmessage_reuse(StringInfobuf);
2424

25-
externvoidpq_sendbytes(StringInfobuf,constchar*data,intdatalen);
25+
externvoidpq_sendbytes(StringInfobuf,constvoid*data,intdatalen);
2626
externvoidpq_sendcountedtext(StringInfobuf,constchar*str,intslen,
2727
boolcountincludesself);
2828
externvoidpq_sendtext(StringInfobuf,constchar*str,intslen);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp