This makes sure that the internal logic of these functions does not
attempt to change the value of the arguments constified, and it removes
one unconstify() in basic_archive.c.
Author: Nathan Bossart
Reviewed-by: Andrew Dunstan, Peter EisentrautDiscussion: https://postgr.es/m/
20230114231126.GA2580330@nathanxps13
* Copy the file to its temporary destination. Note that this will fail
* if temp already exists.
*/
- copy_file(unconstify(char *, path), temp);
+ copy_file(path, temp);
/*
* Sync the temporary file to disk and move it to its final destination.
* a directory or a regular file is ignored.
*/
void
-copydir(char *fromdir, char *todir, bool recurse)
+copydir(const char *fromdir, const char *todir, bool recurse)
{
DIR *xldir;
struct dirent *xlde;
* copy one file
*/
void
-copy_file(char *fromfile, char *tofile)
+copy_file(const char *fromfile, const char *tofile)
{
char *buffer;
int srcfd;
#ifndef COPYDIR_H
#define COPYDIR_H
-extern void copydir(char *fromdir, char *todir, bool recurse);
-extern void copy_file(char *fromfile, char *tofile);
+extern void copydir(const char *fromdir, const char *todir, bool recurse);
+extern void copy_file(const char *fromfile, const char *tofile);
#endif /* COPYDIR_H */