Use g_strndup() directly instead of str_dup_range.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-11-09 21:31:09 +03:00
parent 8425e6fc71
commit 97aa4e99c9
2 changed files with 3 additions and 5 deletions

View File

@ -59,8 +59,6 @@
/* usage: str_cmp ("foo", !=, "bar") */
#define str_cmp(a,rel,b) (strcmp ((a), (b)) rel 0)
#define str_dup_range(s_start, s_bound) (g_strndup(s_start, s_bound - s_start))
#define MC_PTR_FREE(ptr) do { g_free (ptr); (ptr) = NULL; } while (0)
/*** enums ***************************************************************************************/

View File

@ -721,12 +721,12 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
--linkname_bound; /* skip trailing " */
}
ent->name = str_dup_range (filename, filename_bound);
ent->name = g_strndup (filename, filename_bound - filename);
temp = ent->name;
ent->name = strutils_shell_unescape (ent->name);
g_free (temp);
ent->ino->linkname = str_dup_range (linkname, linkname_bound);
ent->ino->linkname = g_strndup (linkname, linkname_bound - linkname);
temp = ent->ino->linkname;
ent->ino->linkname = strutils_shell_unescape (ent->ino->linkname);
g_free (temp);
@ -745,7 +745,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
if (*(filename_bound - 1) == '"')
--filename_bound;
}
ent->name = str_dup_range (filename, filename_bound);
ent->name = g_strndup (filename, filename_bound - filename);
temp = ent->name;
ent->name = strutils_shell_unescape (ent->name);
g_free (temp);