(extfs_get_path_mangle): renamed to extfs_get_path_int

and chnaged type of returned value to pointer to constant.

Related changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-03-11 13:56:14 +03:00
parent 57105745e2
commit 6fc8676c34

View File

@ -238,11 +238,12 @@ extfs_generate_entry (struct archive *archive,
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static struct entry * static struct entry *
extfs_find_entry_int (struct entry *dir, char *name, GSList * list, extfs_find_entry_int (struct entry *dir, const char *name, GSList * list,
gboolean make_dirs, gboolean make_file) gboolean make_dirs, gboolean make_file)
{ {
struct entry *pent, *pdir; struct entry *pent, *pdir;
char *p, *q, *name_end; const char *p, *name_end;
char *q;
char c = PATH_SEP; char c = PATH_SEP;
if (g_path_is_absolute (name)) if (g_path_is_absolute (name))
@ -323,7 +324,7 @@ extfs_find_entry_int (struct entry *dir, char *name, GSList * list,
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static struct entry * static struct entry *
extfs_find_entry (struct entry *dir, char *name, gboolean make_dirs, gboolean make_file) extfs_find_entry (struct entry *dir, const char *name, gboolean make_dirs, gboolean make_file)
{ {
struct entry *res; struct entry *res;
@ -654,12 +655,10 @@ extfs_which (struct vfs_class *me, const char *path)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** /**
* Dissect the path and create corresponding superblock. Note that inname * Dissect the path and create corresponding superblock.
* can be changed and the result may point inside the original string.
*/ */
static const char *
static char * extfs_get_path_int (const vfs_path_t * vpath, struct archive **archive, gboolean do_not_open)
extfs_get_path_mangle (const vfs_path_t * vpath, struct archive **archive, gboolean do_not_open)
{ {
char *archive_name; char *archive_name;
int result = -1; int result = -1;
@ -716,7 +715,7 @@ extfs_get_path_mangle (const vfs_path_t * vpath, struct archive **archive, gbool
static char * static char *
extfs_get_path (const vfs_path_t * vpath, struct archive **archive, gboolean do_not_open) extfs_get_path (const vfs_path_t * vpath, struct archive **archive, gboolean do_not_open)
{ {
return g_strdup (extfs_get_path_mangle (vpath, archive, do_not_open)); return g_strdup (extfs_get_path_int (vpath, archive, do_not_open));
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -1103,11 +1102,11 @@ static int
extfs_internal_stat (const vfs_path_t * vpath, struct stat *buf, gboolean resolve) extfs_internal_stat (const vfs_path_t * vpath, struct stat *buf, gboolean resolve)
{ {
struct archive *archive; struct archive *archive;
char *q; const char *q;
struct entry *entry; struct entry *entry;
int result = -1; int result = -1;
q = extfs_get_path_mangle (vpath, &archive, FALSE); q = extfs_get_path_int (vpath, &archive, FALSE);
if (q == NULL) if (q == NULL)
goto cleanup; goto cleanup;
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE); entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
@ -1158,12 +1157,12 @@ static int
extfs_readlink (const vfs_path_t * vpath, char *buf, size_t size) extfs_readlink (const vfs_path_t * vpath, char *buf, size_t size)
{ {
struct archive *archive; struct archive *archive;
char *q; const char *q;
size_t len; size_t len;
struct entry *entry; struct entry *entry;
int result = -1; int result = -1;
q = extfs_get_path_mangle (vpath, &archive, FALSE); q = extfs_get_path_int (vpath, &archive, FALSE);
if (q == NULL) if (q == NULL)
goto cleanup; goto cleanup;
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE); entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
@ -1224,11 +1223,11 @@ static int
extfs_unlink (const vfs_path_t * vpath) extfs_unlink (const vfs_path_t * vpath)
{ {
struct archive *archive; struct archive *archive;
char *q; const char *q;
struct entry *entry; struct entry *entry;
int result = -1; int result = -1;
q = extfs_get_path_mangle (vpath, &archive, FALSE); q = extfs_get_path_int (vpath, &archive, FALSE);
if (q == NULL) if (q == NULL)
goto cleanup; goto cleanup;
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE); entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
@ -1260,14 +1259,14 @@ static int
extfs_mkdir (const vfs_path_t * vpath, mode_t mode) extfs_mkdir (const vfs_path_t * vpath, mode_t mode)
{ {
struct archive *archive; struct archive *archive;
char *q; const char *q;
struct entry *entry; struct entry *entry;
int result = -1; int result = -1;
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1); vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
(void) mode; (void) mode;
q = extfs_get_path_mangle (vpath, &archive, FALSE); q = extfs_get_path_int (vpath, &archive, FALSE);
if (q == NULL) if (q == NULL)
goto cleanup; goto cleanup;
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE); entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
@ -1305,11 +1304,11 @@ static int
extfs_rmdir (const vfs_path_t * vpath) extfs_rmdir (const vfs_path_t * vpath)
{ {
struct archive *archive; struct archive *archive;
char *q; const char *q;
struct entry *entry; struct entry *entry;
int result = -1; int result = -1;
q = extfs_get_path_mangle (vpath, &archive, FALSE); q = extfs_get_path_int (vpath, &archive, FALSE);
if (q == NULL) if (q == NULL)
goto cleanup; goto cleanup;
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE); entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);