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

Appearance settings

Commit 3b12e68

Browse filesBrowse files
committed
Change argument type of pq_sendbytes from char * to void *
This is a follow-up to 1f605b8. It allows 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 parent a8a4482 commit 3b12e68
Copy full SHA for 3b12e68

File tree

Expand file treeCollapse file tree

5 files changed

+9
-10
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+9
-10
lines changed

‎src/backend/libpq/pqformat.c

Copy file name to clipboardExpand all lines: src/backend/libpq/pqformat.c
+1-1Lines 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(StringInfo buf, const char *data, int datalen)
126+
pq_sendbytes(StringInfo buf, const void *data, int datalen)
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

Copy file name to clipboardExpand all lines: src/backend/utils/adt/array_userfuncs.c
+5-6Lines 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

Copy file name to clipboardExpand all lines: src/backend/utils/adt/uuid.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ uuid_send(PG_FUNCTION_ARGS)
154154
StringInfoData buffer;
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

Copy file name to clipboardExpand all lines: src/backend/utils/adt/varbit.c
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/include/libpq/pqformat.h
+1-1Lines 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
extern void pq_endmessage(StringInfo buf);
2323
extern void pq_endmessage_reuse(StringInfo buf);
2424

25-
extern void pq_sendbytes(StringInfo buf, const char *data, int datalen);
25+
extern void pq_sendbytes(StringInfo buf, const void *data, int datalen);
2626
extern void pq_sendcountedtext(StringInfo buf, const char *str, int slen,
2727
bool countincludesself);
2828
extern void pq_sendtext(StringInfo buf, const char *str, int slen);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.