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

Commit1f605b8

Browse files
committed
Change argument of appendBinaryStringInfo from char * to void *
There is some code that uses this function to assemble some kind ofpacked binary layout, which requires a bunch of casts because of this.Functions taking binary data plus length should take void * instead,like memcpy() for example.Discussion:https://www.postgresql.org/message-id/flat/a0086cfc-ff0f-2827-20fe-52b591d2666c%40enterprisedb.com
1 parent33a33f0 commit1f605b8

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,18 @@ flattenJsonPathParseItem(StringInfo buf, int *result, struct Node *escontext,
267267
casejpiString:
268268
casejpiVariable:
269269
casejpiKey:
270-
appendBinaryStringInfo(buf,(char*)&item->value.string.len,
270+
appendBinaryStringInfo(buf,&item->value.string.len,
271271
sizeof(item->value.string.len));
272272
appendBinaryStringInfo(buf,item->value.string.val,
273273
item->value.string.len);
274274
appendStringInfoChar(buf,'\0');
275275
break;
276276
casejpiNumeric:
277-
appendBinaryStringInfo(buf,(char*)item->value.numeric,
277+
appendBinaryStringInfo(buf,item->value.numeric,
278278
VARSIZE(item->value.numeric));
279279
break;
280280
casejpiBool:
281-
appendBinaryStringInfo(buf,(char*)&item->value.boolean,
281+
appendBinaryStringInfo(buf,&item->value.boolean,
282282
sizeof(item->value.boolean));
283283
break;
284284
casejpiAnd:
@@ -328,11 +328,11 @@ flattenJsonPathParseItem(StringInfo buf, int *result, struct Node *escontext,
328328
int32offs;
329329

330330
appendBinaryStringInfo(buf,
331-
(char*)&item->value.like_regex.flags,
331+
&item->value.like_regex.flags,
332332
sizeof(item->value.like_regex.flags));
333333
offs=reserveSpaceForItemPointer(buf);
334334
appendBinaryStringInfo(buf,
335-
(char*)&item->value.like_regex.patternlen,
335+
&item->value.like_regex.patternlen,
336336
sizeof(item->value.like_regex.patternlen));
337337
appendBinaryStringInfo(buf,item->value.like_regex.pattern,
338338
item->value.like_regex.patternlen);
@@ -393,7 +393,7 @@ flattenJsonPathParseItem(StringInfo buf, int *result, struct Node *escontext,
393393
intoffset;
394394
inti;
395395

396-
appendBinaryStringInfo(buf,(char*)&nelems,sizeof(nelems));
396+
appendBinaryStringInfo(buf,&nelems,sizeof(nelems));
397397

398398
offset=buf->len;
399399

@@ -431,10 +431,10 @@ flattenJsonPathParseItem(StringInfo buf, int *result, struct Node *escontext,
431431
break;
432432
casejpiAny:
433433
appendBinaryStringInfo(buf,
434-
(char*)&item->value.anybounds.first,
434+
&item->value.anybounds.first,
435435
sizeof(item->value.anybounds.first));
436436
appendBinaryStringInfo(buf,
437-
(char*)&item->value.anybounds.last,
437+
&item->value.anybounds.last,
438438
sizeof(item->value.anybounds.last));
439439
break;
440440
casejpiType:
@@ -496,7 +496,7 @@ reserveSpaceForItemPointer(StringInfo buf)
496496
int32pos=buf->len;
497497
int32ptr=0;
498498

499-
appendBinaryStringInfo(buf,(char*)&ptr,sizeof(ptr));
499+
appendBinaryStringInfo(buf,&ptr,sizeof(ptr));
500500

501501
returnpos;
502502
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ buf_init(FullTransactionId xmin, FullTransactionId xmax)
260260
snap.nxip=0;
261261

262262
buf=makeStringInfo();
263-
appendBinaryStringInfo(buf,(char*)&snap,PG_SNAPSHOT_SIZE(0));
263+
appendBinaryStringInfo(buf,&snap,PG_SNAPSHOT_SIZE(0));
264264
returnbuf;
265265
}
266266

@@ -272,7 +272,7 @@ buf_add_txid(StringInfo buf, FullTransactionId fxid)
272272
/* do this before possible realloc */
273273
snap->nxip++;
274274

275-
appendBinaryStringInfo(buf,(char*)&fxid,sizeof(fxid));
275+
appendBinaryStringInfo(buf,&fxid,sizeof(fxid));
276276
}
277277

278278
staticpg_snapshot*

‎src/common/stringinfo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ appendStringInfoSpaces(StringInfo str, int count)
224224
* if necessary. Ensures that a trailing null byte is present.
225225
*/
226226
void
227-
appendBinaryStringInfo(StringInfostr,constchar*data,intdatalen)
227+
appendBinaryStringInfo(StringInfostr,constvoid*data,intdatalen)
228228
{
229229
Assert(str!=NULL);
230230

@@ -250,7 +250,7 @@ appendBinaryStringInfo(StringInfo str, const char *data, int datalen)
250250
* if necessary. Does not ensure a trailing null-byte exists.
251251
*/
252252
void
253-
appendBinaryStringInfoNT(StringInfostr,constchar*data,intdatalen)
253+
appendBinaryStringInfoNT(StringInfostr,constvoid*data,intdatalen)
254254
{
255255
Assert(str!=NULL);
256256

‎src/include/lib/stringinfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ extern void appendStringInfoSpaces(StringInfo str, int count);
142142
* if necessary.
143143
*/
144144
externvoidappendBinaryStringInfo(StringInfostr,
145-
constchar*data,intdatalen);
145+
constvoid*data,intdatalen);
146146

147147
/*------------------------
148148
* appendBinaryStringInfoNT
149149
* Append arbitrary binary data to a StringInfo, allocating more space
150150
* if necessary. Does not ensure a trailing null-byte exists.
151151
*/
152152
externvoidappendBinaryStringInfoNT(StringInfostr,
153-
constchar*data,intdatalen);
153+
constvoid*data,intdatalen);
154154

155155
/*------------------------
156156
* enlargeStringInfo

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp