* cygpath.cc (get_mixed_name): Drop function. Replace with call to

convert_slashes throughout.
	(do_sysfolders): Free allocated buffer.
	(do_pathconv): Fix freeing last buffer.
This commit is contained in:
Corinna Vinschen 2010-01-16 10:25:58 +00:00
parent 1a8d1e1040
commit 1b526b480b
2 changed files with 15 additions and 35 deletions

View File

@ -1,3 +1,10 @@
2010-01-16 Corinna Vinschen <corinna@vinschen.de>
* cygpath.cc (get_mixed_name): Drop function. Replace with call to
convert_slashes throughout.
(do_sysfolders): Free allocated buffer.
(do_pathconv): Fix freeing last buffer.
2010-01-11 Corinna Vinschen <corinna@vinschen.de> 2010-01-11 Corinna Vinschen <corinna@vinschen.de>
* mount.cc (do_mount_from_fstab): Allow to change cygdrive prefix, too. * mount.cc (do_mount_from_fstab): Allow to change cygdrive prefix, too.

View File

@ -539,22 +539,6 @@ convert_slashes (char* name)
} }
} }
static char *
get_mixed_name (const char* filename)
{
char* mixed_buf = strdup (filename);
if (mixed_buf == NULL)
{
fprintf (stderr, "%s: out of memory\n", prog_name);
exit (1);
}
convert_slashes (mixed_buf);
return mixed_buf;
}
static bool static bool
get_special_folder (char* path, int id) get_special_folder (char* path, int id)
{ {
@ -575,6 +559,7 @@ static void
do_sysfolders (char option) do_sysfolders (char option)
{ {
char *buf, buf1[PATH_MAX], buf2[PATH_MAX]; char *buf, buf1[PATH_MAX], buf2[PATH_MAX];
char *tmp = NULL;
WCHAR wbuf[MAX_PATH]; WCHAR wbuf[MAX_PATH];
DWORD len = MAX_PATH; DWORD len = MAX_PATH;
WIN32_FIND_DATAW w32_fd; WIN32_FIND_DATAW w32_fd;
@ -667,20 +652,14 @@ do_sysfolders (char option)
} }
else else
{ {
char *tmp;
if (shortname_flag) if (shortname_flag)
{ tmp = buf = get_short_name (buf);
buf = get_short_name (tmp = buf);
free (tmp);
}
if (mixed_flag) if (mixed_flag)
{ convert_slashes (buf);
buf = get_mixed_name (tmp = buf);
free (tmp);
}
} }
printf ("%s\n", buf); printf ("%s\n", buf);
if (tmp)
free (tmp);
} }
static void static void
@ -759,10 +738,7 @@ do_pathconv (char *filename)
free (tmp); free (tmp);
} }
if (mixed_flag) if (mixed_flag)
{ convert_slashes (buf);
buf = get_mixed_name (tmp = buf);
free (tmp);
}
} }
if (err) if (err)
{ {
@ -812,10 +788,7 @@ do_pathconv (char *filename)
} }
} }
if (mixed_flag) if (mixed_flag)
{ convert_slashes (buf);
buf = get_mixed_name (buf);
free (tmp);
}
} }
} }
@ -823,7 +796,7 @@ do_pathconv (char *filename)
if (buf2) if (buf2)
free (buf2); free (buf2);
if (buf) if (buf)
free (buf); free (tmp);
} }
static void static void