From db3f21b70288513c11b41ec6358431f2b8cc2873 Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Mon, 16 Aug 2004 16:34:11 +0000 Subject: [PATCH] Added a typedef for a function. Added more const-ness to the function arguments. --- vfs/direntry.c | 2 +- vfs/extfs.c | 2 +- vfs/fish.c | 2 +- vfs/ftpfs.c | 2 +- vfs/mcfs.c | 2 +- vfs/sfs.c | 2 +- vfs/smbfs.c | 2 +- vfs/vfs.c | 3 +-- vfs/vfs.h | 6 ++++-- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/vfs/direntry.c b/vfs/direntry.c index d661c2988..851c35fb3 100644 --- a/vfs/direntry.c +++ b/vfs/direntry.c @@ -964,7 +964,7 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino) /* ------------------------------- mc support ---------------------------- */ static void -vfs_s_fill_names (struct vfs_class *me, void (*func)(char *)) +vfs_s_fill_names (struct vfs_class *me, fill_names_f func) { struct vfs_s_super *a = MEDATA->supers; char *name; diff --git a/vfs/extfs.c b/vfs/extfs.c index 809deeba6..3d4817fcb 100644 --- a/vfs/extfs.c +++ b/vfs/extfs.c @@ -104,7 +104,7 @@ static char extfs_need_archive [MAXEXTFS]; static int extfs_no = 0; static void -extfs_fill_names (struct vfs_class *me, void (*func) (char *)) +extfs_fill_names (struct vfs_class *me, fill_names_f func) { struct archive *a = first_archive; char *name; diff --git a/vfs/fish.c b/vfs/fish.c index 908cca38d..cc2932ae0 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -846,7 +846,7 @@ fish_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, } static void -fish_fill_names (struct vfs_class *me, void (*func)(char *)) +fish_fill_names (struct vfs_class *me, fill_names_f func) { struct vfs_s_super *super = MEDATA->supers; char *flags; diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 746fa62f7..99d5e349d 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -1653,7 +1653,7 @@ ftpfs_done (struct vfs_class *me) } static void -ftpfs_fill_names (struct vfs_class *me, void (*func)(char *)) +ftpfs_fill_names (struct vfs_class *me, fill_names_f func) { struct vfs_s_super *super = MEDATA->supers; char *name; diff --git a/vfs/mcfs.c b/vfs/mcfs.c index 5a445422a..e60eb0552 100644 --- a/vfs/mcfs.c +++ b/vfs/mcfs.c @@ -90,7 +90,7 @@ mcfs_get_host_and_username (const char *path, char **host, char **user, } static void -mcfs_fill_names (struct vfs_class *me, void (*func) (char *)) +mcfs_fill_names (struct vfs_class *me, fill_names_f func) { int i; char *name; diff --git a/vfs/sfs.c b/vfs/sfs.c index 53fe6f611..b7583e27f 100644 --- a/vfs/sfs.c +++ b/vfs/sfs.c @@ -275,7 +275,7 @@ static void sfs_free (vfsid id) g_free (cur); } -static void sfs_fill_names (struct vfs_class *me, void (*func)(char *)) +static void sfs_fill_names (struct vfs_class *me, fill_names_f func) { struct cachedfile *cur = head; diff --git a/vfs/smbfs.c b/vfs/smbfs.c index 9b84c0cd2..fdc7efb9e 100644 --- a/vfs/smbfs.c +++ b/vfs/smbfs.c @@ -322,7 +322,7 @@ smbfs_init (struct vfs_class * me) } static void -smbfs_fill_names (struct vfs_class *me, void (*func)(char *)) +smbfs_fill_names (struct vfs_class *me, fill_names_f func) { int i; char *path; diff --git a/vfs/vfs.c b/vfs/vfs.c index 49336851d..08748143e 100644 --- a/vfs/vfs.c +++ b/vfs/vfs.c @@ -897,7 +897,6 @@ mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed) (*vfs->ungetlocalcopy)(vfs, path, local, has_changed) : mc_def_ungetlocalcopy (vfs, path, local, has_changed); g_free (path); - g_free (local); return return_value; } @@ -956,7 +955,7 @@ vfs_shut (void) * and handles them to an upper layer */ void -vfs_fill_names (void (*func)(char *)) +vfs_fill_names (fill_names_f func) { struct vfs_class *vfs; diff --git a/vfs/vfs.h b/vfs/vfs.h index 724675538..65ab6893c 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -13,6 +13,8 @@ struct vfs_stamping; #define VFSF_LOCAL 1 /* Class is local (not virtual) filesystem */ #define VFSF_NOLINKS 2 /* Hard links not supported */ +typedef void (*fill_names_f) (const char *); + struct vfs_class { struct vfs_class *next; char *name; /* "FIles over SHell" */ @@ -23,7 +25,7 @@ struct vfs_class { int (*init) (struct vfs_class *me); void (*done) (struct vfs_class *me); - void (*fill_names) (struct vfs_class *me, void (*)(char *)); + void (*fill_names) (struct vfs_class *me, fill_names_f); int (*which) (struct vfs_class *me, /*FIXME:const*/ char *path); @@ -123,7 +125,7 @@ vfs_file_is_local (const char *filename) return vfs_file_class_flags (filename) & VFSF_LOCAL; } -void vfs_fill_names (void (*)(char *)); +void vfs_fill_names (fill_names_f); char *vfs_translate_url (const char *); #ifdef USE_NETCODE