mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 09:19:24 +03:00
Use g_strndup() directly instead of str_dup_range.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
8425e6fc71
commit
97aa4e99c9
@ -59,8 +59,6 @@
|
|||||||
/* usage: str_cmp ("foo", !=, "bar") */
|
/* usage: str_cmp ("foo", !=, "bar") */
|
||||||
#define str_cmp(a,rel,b) (strcmp ((a), (b)) rel 0)
|
#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)
|
#define MC_PTR_FREE(ptr) do { g_free (ptr); (ptr) = NULL; } while (0)
|
||||||
|
|
||||||
/*** enums ***************************************************************************************/
|
/*** enums ***************************************************************************************/
|
||||||
|
@ -721,12 +721,12 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
|||||||
--linkname_bound; /* skip trailing " */
|
--linkname_bound; /* skip trailing " */
|
||||||
}
|
}
|
||||||
|
|
||||||
ent->name = str_dup_range (filename, filename_bound);
|
ent->name = g_strndup (filename, filename_bound - filename);
|
||||||
temp = ent->name;
|
temp = ent->name;
|
||||||
ent->name = strutils_shell_unescape (ent->name);
|
ent->name = strutils_shell_unescape (ent->name);
|
||||||
g_free (temp);
|
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;
|
temp = ent->ino->linkname;
|
||||||
ent->ino->linkname = strutils_shell_unescape (ent->ino->linkname);
|
ent->ino->linkname = strutils_shell_unescape (ent->ino->linkname);
|
||||||
g_free (temp);
|
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) == '"')
|
if (*(filename_bound - 1) == '"')
|
||||||
--filename_bound;
|
--filename_bound;
|
||||||
}
|
}
|
||||||
ent->name = str_dup_range (filename, filename_bound);
|
ent->name = g_strndup (filename, filename_bound - filename);
|
||||||
temp = ent->name;
|
temp = ent->name;
|
||||||
ent->name = strutils_shell_unescape (ent->name);
|
ent->name = strutils_shell_unescape (ent->name);
|
||||||
g_free (temp);
|
g_free (temp);
|
||||||
|
Loading…
Reference in New Issue
Block a user