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

Commitfaf3750

Browse files
committed
Add const to BufFileWrite
Make data buffer argument to BufFileWrite a const pointer and bubblethis up to various callers and related APIs. This makes the APIsclearer and more consistent.Discussion:https://www.postgresql.org/message-id/flat/11dda853-bb5b-59ba-a746-e168b1ce4bdb%40enterprisedb.com
1 parent5f2f99c commitfaf3750

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static long gistBuffersGetFreeBlock(GISTBuildBuffers *gfbb);
3838
staticvoidgistBuffersReleaseBlock(GISTBuildBuffers*gfbb,longblocknum);
3939

4040
staticvoidReadTempFileBlock(BufFile*file,longblknum,void*ptr);
41-
staticvoidWriteTempFileBlock(BufFile*file,longblknum,void*ptr);
41+
staticvoidWriteTempFileBlock(BufFile*file,longblknum,constvoid*ptr);
4242

4343

4444
/*
@@ -764,7 +764,7 @@ ReadTempFileBlock(BufFile *file, long blknum, void *ptr)
764764
}
765765

766766
staticvoid
767-
WriteTempFileBlock(BufFile*file,longblknum,void*ptr)
767+
WriteTempFileBlock(BufFile*file,longblknum,constvoid*ptr)
768768
{
769769
if (BufFileSeekBlock(file,blknum)!=0)
770770
elog(ERROR,"could not seek to block %ld in temporary file",blknum);

‎src/backend/backup/backup_manifest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include"utils/builtins.h"
2222
#include"utils/json.h"
2323

24-
staticvoidAppendStringToManifest(backup_manifest_info*manifest,char*s);
24+
staticvoidAppendStringToManifest(backup_manifest_info*manifest,constchar*s);
2525

2626
/*
2727
* Does the user want a backup manifest?
@@ -385,7 +385,7 @@ SendBackupManifest(backup_manifest_info *manifest, bbsink *sink)
385385
* Append a cstring to the manifest.
386386
*/
387387
staticvoid
388-
AppendStringToManifest(backup_manifest_info*manifest,char*s)
388+
AppendStringToManifest(backup_manifest_info*manifest,constchar*s)
389389
{
390390
intlen=strlen(s);
391391

‎src/backend/storage/file/buffile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ BufFileRead(BufFile *file, void *ptr, size_t size)
622622
* ereport().
623623
*/
624624
void
625-
BufFileWrite(BufFile*file,void*ptr,size_tsize)
625+
BufFileWrite(BufFile*file,constvoid*ptr,size_tsize)
626626
{
627627
size_tnthistime;
628628

@@ -655,7 +655,7 @@ BufFileWrite(BufFile *file, void *ptr, size_t size)
655655
file->pos+=nthistime;
656656
if (file->nbytes<file->pos)
657657
file->nbytes=file->pos;
658-
ptr= (char*)ptr+nthistime;
658+
ptr= (constchar*)ptr+nthistime;
659659
size-=nthistime;
660660
}
661661
}

‎src/backend/utils/sort/logtape.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ struct LogicalTapeSet
220220
};
221221

222222
staticLogicalTape*ltsCreateTape(LogicalTapeSet*lts);
223-
staticvoidltsWriteBlock(LogicalTapeSet*lts,longblocknum,void*buffer);
223+
staticvoidltsWriteBlock(LogicalTapeSet*lts,longblocknum,constvoid*buffer);
224224
staticvoidltsReadBlock(LogicalTapeSet*lts,longblocknum,void*buffer);
225225
staticlongltsGetBlock(LogicalTapeSet*lts,LogicalTape*lt);
226226
staticlongltsGetFreeBlock(LogicalTapeSet*lts);
@@ -235,7 +235,7 @@ static void ltsInitReadBuffer(LogicalTape *lt);
235235
* No need for an error return convention; we ereport() on any error.
236236
*/
237237
staticvoid
238-
ltsWriteBlock(LogicalTapeSet*lts,longblocknum,void*buffer)
238+
ltsWriteBlock(LogicalTapeSet*lts,longblocknum,constvoid*buffer)
239239
{
240240
/*
241241
* BufFile does not support "holes", so if we're about to write a block
@@ -759,7 +759,7 @@ LogicalTapeSetForgetFreeSpace(LogicalTapeSet *lts)
759759
* There are no error returns; we ereport() on failure.
760760
*/
761761
void
762-
LogicalTapeWrite(LogicalTape*lt,void*ptr,size_tsize)
762+
LogicalTapeWrite(LogicalTape*lt,constvoid*ptr,size_tsize)
763763
{
764764
LogicalTapeSet*lts=lt->tapeSet;
765765
size_tnthistime;
@@ -826,7 +826,7 @@ LogicalTapeWrite(LogicalTape *lt, void *ptr, size_t size)
826826
lt->pos+=nthistime;
827827
if (lt->nbytes<lt->pos)
828828
lt->nbytes=lt->pos;
829-
ptr= (char*)ptr+nthistime;
829+
ptr= (constchar*)ptr+nthistime;
830830
size-=nthistime;
831831
}
832832
}

‎src/include/storage/buffile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef struct BufFile BufFile;
3939
externBufFile*BufFileCreateTemp(boolinterXact);
4040
externvoidBufFileClose(BufFile*file);
4141
externsize_tBufFileRead(BufFile*file,void*ptr,size_tsize);
42-
externvoidBufFileWrite(BufFile*file,void*ptr,size_tsize);
42+
externvoidBufFileWrite(BufFile*file,constvoid*ptr,size_tsize);
4343
externintBufFileSeek(BufFile*file,intfileno,off_toffset,intwhence);
4444
externvoidBufFileTell(BufFile*file,int*fileno,off_t*offset);
4545
externintBufFileSeekBlock(BufFile*file,longblknum);

‎src/include/utils/logtape.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ extern LogicalTape *LogicalTapeCreate(LogicalTapeSet *lts);
6666
externLogicalTape*LogicalTapeImport(LogicalTapeSet*lts,intworker,TapeShare*shared);
6767
externvoidLogicalTapeSetForgetFreeSpace(LogicalTapeSet*lts);
6868
externsize_tLogicalTapeRead(LogicalTape*lt,void*ptr,size_tsize);
69-
externvoidLogicalTapeWrite(LogicalTape*lt,void*ptr,size_tsize);
69+
externvoidLogicalTapeWrite(LogicalTape*lt,constvoid*ptr,size_tsize);
7070
externvoidLogicalTapeRewindForRead(LogicalTape*lt,size_tbuffer_size);
7171
externvoidLogicalTapeFreeze(LogicalTape*lt,TapeShare*share);
7272
externsize_tLogicalTapeBackspace(LogicalTape*lt,size_tsize);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp