1
1

* direntry.c: Added const qualifier to function declarations and

variables. Introduced local modifiable strings where necessary.
	* xdirentry.h: likewise.
Этот коммит содержится в:
Roland Illig 2004-09-19 16:07:17 +00:00
родитель 9c334b4dd8
Коммит a9f9db7b6b
3 изменённых файлов: 34 добавлений и 16 удалений

Просмотреть файл

@ -1,3 +1,9 @@
2004-09-19 Roland Illig <roland.illig@gmx.de>
* direntry.c: Added const qualifier to function declarations and
variables. Introduced local modifiable strings where necessary.
* xdirentry.h: likewise.
2004-09-18 Roland Illig <roland.illig@gmx.de>
* smbfs.c (smbfs_init): Added a cast to avoid compiler warning.

Просмотреть файл

@ -61,7 +61,7 @@ vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, struct stat *i
}
struct vfs_s_entry *
vfs_s_new_entry (struct vfs_class *me, char *name, struct vfs_s_inode *inode)
vfs_s_new_entry (struct vfs_class *me, const char *name, struct vfs_s_inode *inode)
{
struct vfs_s_entry *entry;
@ -164,7 +164,7 @@ vfs_s_default_stat (struct vfs_class *me, mode_t mode)
}
struct vfs_s_entry *
vfs_s_generate_entry (struct vfs_class *me, char *name, struct vfs_s_inode *parent, mode_t mode)
vfs_s_generate_entry (struct vfs_class *me, const char *name, struct vfs_s_inode *parent, mode_t mode)
{
struct vfs_s_inode *inode;
struct stat *st;
@ -238,10 +238,11 @@ vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry,
*/
static struct vfs_s_entry *
vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
char *path, int follow, int flags)
const char *a_path, int follow, int flags)
{
size_t pseg;
struct vfs_s_entry *ent = NULL;
char *path = g_strdup (a_path);
canonicalize_pathname (path);
@ -249,8 +250,10 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
while (*path == PATH_SEP) /* Strip leading '/' */
path++;
if (!path[0])
if (!path[0]) {
g_free (path);
return ent;
}
for (pseg = 0; path[pseg] && path[pseg] != PATH_SEP; pseg++);
@ -273,10 +276,11 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
PATH_SEP) ? LINK_FOLLOW :
follow);
if (!ent)
return NULL;
goto cleanup;
root = ent->ino;
}
cleanup:
g_free (path);
return NULL;
}
@ -299,9 +303,11 @@ split_dir_name (struct vfs_class *me, char *path, char **dir, char **name, char
static struct vfs_s_entry *
vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
char *path, int follow, int flags)
const char *a_path, int follow, int flags)
{
struct vfs_s_entry *ent = NULL;
char *path = g_strdup (a_path);
struct vfs_s_entry *retval = NULL;
if (root->super->root != root)
vfs_die ("We have to use _real_ root. Always. Sorry.");
@ -317,7 +323,9 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
flags | FL_DIR);
if (save)
*save = PATH_SEP;
return vfs_s_find_entry_tree (me, ino, name, follow, flags);
retval = vfs_s_find_entry_tree (me, ino, name, follow, flags);
g_free (path);
return retval;
}
for (ent = root->subdir; ent != NULL; ent = ent->next)
@ -341,6 +349,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
ent = vfs_s_new_entry (me, path, ino);
if ((MEDATA->dir_load) (me, ino, path) == -1) {
vfs_s_free_entry (me, ent);
g_free (path);
return NULL;
}
vfs_s_insert_entry (me, root, ent);
@ -353,15 +362,18 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
vfs_die ("find_linear: success but directory is not there\n");
#if 0
if (!vfs_s_resolve_symlink (me, ent, follow))
if (!vfs_s_resolve_symlink (me, ent, follow)) {
g_free (path);
return NULL;
}
#endif
g_free (path);
return ent;
}
struct vfs_s_inode *
vfs_s_find_inode (struct vfs_class *me, const struct vfs_s_super *super,
char *path, int follow, int flags)
const char *path, int follow, int flags)
{
struct vfs_s_entry *ent;
if (!(MEDATA->flags & VFS_S_REMOTE) && (!*path))
@ -884,8 +896,8 @@ static void
vfs_s_print_stats (const char *fs_name, const char *action,
const char *file_name, off_t have, off_t need)
{
static char *i18n_percent_transf_format = NULL, *i18n_transf_format =
NULL;
static const char *i18n_percent_transf_format = NULL;
static const char *i18n_transf_format = NULL;
if (i18n_percent_transf_format == NULL) {
i18n_percent_transf_format =

Просмотреть файл

@ -140,7 +140,7 @@ struct vfs_s_subclass {
struct vfs_s_entry *(*find_entry) (struct vfs_class *me,
struct vfs_s_inode *root,
char *path, int follow, int flags);
const char *path, int follow, int flags);
int (*dir_load) (struct vfs_class *me, struct vfs_s_inode *ino,
char *path);
int (*dir_uptodate) (struct vfs_class *me, struct vfs_s_inode *ino);
@ -159,19 +159,19 @@ struct vfs_s_subclass {
struct vfs_s_inode *vfs_s_new_inode (struct vfs_class *me,
struct vfs_s_super *super,
struct stat *initstat);
struct vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, char *name,
struct vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, const char *name,
struct vfs_s_inode *inode);
void vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent);
void vfs_s_insert_entry (struct vfs_class *me, struct vfs_s_inode *dir,
struct vfs_s_entry *ent);
struct stat *vfs_s_default_stat (struct vfs_class *me, mode_t mode);
struct vfs_s_entry *vfs_s_generate_entry (struct vfs_class *me, char *name,
struct vfs_s_entry *vfs_s_generate_entry (struct vfs_class *me, const char *name,
struct vfs_s_inode *parent,
mode_t mode);
struct vfs_s_inode *vfs_s_find_inode (struct vfs_class *me,
const struct vfs_s_super *super,
char *path, int follow, int flags);
const char *path, int follow, int flags);
struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me,
struct vfs_s_entry *entry);