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

Commit2f31f40

Browse files
committed
Constify the arguments of copydir.h functions
This makes sure that the internal logic of these functions does notattempt to change the value of the arguments constified, and it removesone unconstify() in basic_archive.c.Author: Nathan BossartReviewed-by: Andrew Dunstan, Peter EisentrautDiscussion:https://postgr.es/m/20230114231126.GA2580330@nathanxps13
1 parent09d465c commit2f31f40

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

‎contrib/basic_archive/basic_archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ basic_archive_file_internal(const char *file, const char *path)
275275
* Copy the file to its temporary destination. Note that this will fail
276276
* if temp already exists.
277277
*/
278-
copy_file(unconstify(char*,path),temp);
278+
copy_file(path,temp);
279279

280280
/*
281281
* Sync the temporary file to disk and move it to its final destination.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* a directory or a regular file is ignored.
3535
*/
3636
void
37-
copydir(char*fromdir,char*todir,boolrecurse)
37+
copydir(constchar*fromdir,constchar*todir,boolrecurse)
3838
{
3939
DIR*xldir;
4040
structdirent*xlde;
@@ -114,7 +114,7 @@ copydir(char *fromdir, char *todir, bool recurse)
114114
* copy one file
115115
*/
116116
void
117-
copy_file(char*fromfile,char*tofile)
117+
copy_file(constchar*fromfile,constchar*tofile)
118118
{
119119
char*buffer;
120120
intsrcfd;

‎src/include/storage/copydir.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndefCOPYDIR_H
1414
#defineCOPYDIR_H
1515

16-
externvoidcopydir(char*fromdir,char*todir,boolrecurse);
17-
externvoidcopy_file(char*fromfile,char*tofile);
16+
externvoidcopydir(constchar*fromdir,constchar*todir,boolrecurse);
17+
externvoidcopy_file(constchar*fromfile,constchar*tofile);
1818

1919
#endif/* COPYDIR_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp