mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
* vfs.c (mc_ungetlocalcopy): Free local path here, not in class
implementations. * vfs.h (struct vfs_s_class): Constify "local" argument for ungetlocalcopy. Adjust all implementations.
This commit is contained in:
parent
bb184c9c8b
commit
77bcdc8127
@ -1,5 +1,10 @@
|
|||||||
2003-10-28 Pavel Roskin <proski@gnu.org>
|
2003-10-28 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* vfs.c (mc_ungetlocalcopy): Free local path here, not in class
|
||||||
|
implementations.
|
||||||
|
* vfs.h (struct vfs_s_class): Constify "local" argument for
|
||||||
|
ungetlocalcopy. Adjust all implementations.
|
||||||
|
|
||||||
* direntry.c (vfs_s_init_class): Use our getlocalcopy for remote
|
* direntry.c (vfs_s_init_class): Use our getlocalcopy for remote
|
||||||
filesystems that cache files, not for archives.
|
filesystems that cache files, not for archives.
|
||||||
(vfs_s_getlocalcopy): Corresponding changes.
|
(vfs_s_getlocalcopy): Corresponding changes.
|
||||||
|
@ -997,10 +997,9 @@ vfs_s_getlocalcopy (struct vfs_class *me, const char *path)
|
|||||||
* the cache will be removed when the archive is closed.
|
* the cache will be removed when the archive is closed.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
vfs_s_ungetlocalcopy (struct vfs_class *me, const char *path, char *local,
|
vfs_s_ungetlocalcopy (struct vfs_class *me, const char *path,
|
||||||
int has_changed)
|
const char *local, int has_changed)
|
||||||
{
|
{
|
||||||
g_free (local);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ static void extfs_free_archive (struct archive *archive)
|
|||||||
mc_stat (archive->local_name, &my);
|
mc_stat (archive->local_name, &my);
|
||||||
mc_ungetlocalcopy (archive->name, archive->local_name,
|
mc_ungetlocalcopy (archive->name, archive->local_name,
|
||||||
archive->local_stat.st_mtime != my.st_mtime);
|
archive->local_stat.st_mtime != my.st_mtime);
|
||||||
/* ungetlocalcopy frees local_name for us */
|
/* mc_ungetlocalcopy() frees local_name for us */
|
||||||
}
|
}
|
||||||
if (archive->name)
|
if (archive->name)
|
||||||
g_free (archive->name);
|
g_free (archive->name);
|
||||||
@ -1254,8 +1254,8 @@ extfs_getlocalcopy (struct vfs_class *me, const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
extfs_ungetlocalcopy (struct vfs_class *me, const char *path, char *local,
|
extfs_ungetlocalcopy (struct vfs_class *me, const char *path,
|
||||||
int has_changed)
|
const char *local, int has_changed)
|
||||||
{
|
{
|
||||||
struct pseudofile *fp =
|
struct pseudofile *fp =
|
||||||
(struct pseudofile *) extfs_open (me, path, O_RDONLY, 0);
|
(struct pseudofile *) extfs_open (me, path, O_RDONLY, 0);
|
||||||
|
@ -255,8 +255,8 @@ local_getlocalcopy (struct vfs_class *me, const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
local_ungetlocalcopy (struct vfs_class *me, const char *path, char *local,
|
local_ungetlocalcopy (struct vfs_class *me, const char *path,
|
||||||
int has_changed)
|
const char *local, int has_changed)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -301,10 +301,9 @@ sfs_getlocalcopy (struct vfs_class *me, const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sfs_ungetlocalcopy (struct vfs_class *me, const char *path, char *local,
|
sfs_ungetlocalcopy (struct vfs_class *me, const char *path,
|
||||||
int has_changed)
|
const char *local, int has_changed)
|
||||||
{
|
{
|
||||||
g_free (local);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1081,7 +1081,7 @@ mc_getlocalcopy (const char *pathname)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
||||||
char *local, int has_changed)
|
const char *local, int has_changed)
|
||||||
{
|
{
|
||||||
int fdin = -1, fdout = -1, i;
|
int fdin = -1, fdout = -1, i;
|
||||||
if (has_changed) {
|
if (has_changed) {
|
||||||
@ -1114,7 +1114,6 @@ mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
unlink (local);
|
unlink (local);
|
||||||
g_free (local);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
@ -1124,7 +1123,6 @@ mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
|||||||
if (fdin != -1)
|
if (fdin != -1)
|
||||||
close (fdin);
|
close (fdin);
|
||||||
unlink (local);
|
unlink (local);
|
||||||
g_free (local);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1139,6 +1137,7 @@ mc_ungetlocalcopy (const char *pathname, char *local, int has_changed)
|
|||||||
(*vfs->ungetlocalcopy)(vfs, path, local, has_changed) :
|
(*vfs->ungetlocalcopy)(vfs, path, local, has_changed) :
|
||||||
mc_def_ungetlocalcopy (vfs, path, local, has_changed);
|
mc_def_ungetlocalcopy (vfs, path, local, has_changed);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
g_free (local);
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ struct vfs_class {
|
|||||||
|
|
||||||
char *(*getlocalcopy) (struct vfs_class *me, const char *filename);
|
char *(*getlocalcopy) (struct vfs_class *me, const char *filename);
|
||||||
int (*ungetlocalcopy) (struct vfs_class *me, const char *filename,
|
int (*ungetlocalcopy) (struct vfs_class *me, const char *filename,
|
||||||
char *local, int has_changed);
|
const char *local, int has_changed);
|
||||||
|
|
||||||
int (*mkdir) (struct vfs_class *me, char *path, mode_t mode);
|
int (*mkdir) (struct vfs_class *me, char *path, mode_t mode);
|
||||||
int (*rmdir) (struct vfs_class *me, char *path);
|
int (*rmdir) (struct vfs_class *me, char *path);
|
||||||
|
Loading…
Reference in New Issue
Block a user