Some more g_strdup_printf() eliminated
Timur I. Bakeyev
timur at com.bat.ru
Thu Dec 11 16:40:29 UTC 2003
Hi all!
Just a note - if you dealing with paths, it's HIGHLY recommended to use
PATH_SEP instead of "/", and corresponding char constant instead of '/'.
Please!
WBR,
Timur.
On Mon, Nov 24, 2003 at 06:12:17PM +0200, Andrew V. Samoilov wrote:
> vfs/ChangeLog:
> * direntry.c (vfs_s_resolve_symlink): Eliminate g_strdup_printf().
> (vfs_s_fullpath): Ditto.
>
> --- vfs/direntry.c
> +++ vfs/direntry.c
> @@ -217,7 +217,7 @@ vfs_s_resolve_symlink (struct vfs_class
> /* make full path from relative */
> if (*linkname != PATH_SEP) {
> char *fullpath = vfs_s_fullpath (me, entry->dir);
> - fullname = g_strdup_printf ("%s/%s", fullpath, linkname);
> + fullname = g_strconcat (fullpath, "/", linkname, NULL);
> linkname = fullname;
> g_free (fullpath);
> }
> @@ -522,7 +522,7 @@ vfs_s_fullpath (struct vfs_class *me, st
> ino = ino->ent->dir;
> if (ino == ino->super->root)
> break;
> - newpath = g_strdup_printf ("%s/%s", ino->ent->name, path);
> + newpath = g_strconcat (ino->ent->name, "/", path, NULL);
> g_free (path);
> path = newpath;
> }
More information about the mc-devel
mailing list