* editcmd.c (edit_canonicalize_pathname): Don't ever use
getwd(), use g_get_current_dir() instead.
Этот коммит содержится в:
родитель
48101333b5
Коммит
6f8e77f1fb
@ -1,5 +1,8 @@
|
|||||||
2001-07-19 Pavel Roskin <proski@gnu.org>
|
2001-07-19 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* editcmd.c (edit_canonicalize_pathname): Don't ever use
|
||||||
|
getwd(), use g_get_current_dir() instead.
|
||||||
|
|
||||||
* editoptions.c (edit_options_dialog): Call edit_load_syntax()
|
* editoptions.c (edit_options_dialog): Call edit_load_syntax()
|
||||||
if user turned syntax highlighting off to unload the rules.
|
if user turned syntax highlighting off to unload the rules.
|
||||||
|
|
||||||
|
@ -440,27 +440,23 @@ void edit_split_filename (WEdit * edit, const char *f)
|
|||||||
|
|
||||||
#ifdef GTK
|
#ifdef GTK
|
||||||
|
|
||||||
static char cwd[1040];
|
|
||||||
|
|
||||||
static char *edit_canonicalize_pathname (const char *p)
|
static char *edit_canonicalize_pathname (const char *p)
|
||||||
{
|
{
|
||||||
char *q, *r;
|
char *q, *r;
|
||||||
char *t = NULL;
|
char *t = NULL;
|
||||||
|
char *cwd;
|
||||||
|
|
||||||
if (*p != '/') {
|
if (*p != '/') {
|
||||||
if (strlen (cwd) == 0) {
|
cwd = g_get_current_dir ();
|
||||||
#ifdef HAVE_GETCWD
|
t = g_malloc (strlen (cwd) + strlen (p) + 2);
|
||||||
getcwd (cwd, MAX_PATH_LEN);
|
|
||||||
#else
|
|
||||||
getwd (cwd);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
t = malloc (strlen (cwd) + strlen (p) + 2);
|
|
||||||
strcpy (t, cwd);
|
strcpy (t, cwd);
|
||||||
strcat (t, "/");
|
strcat (t, "/");
|
||||||
strcat (t, p);
|
strcat (t, p);
|
||||||
|
g_free (cwd);
|
||||||
p = t;
|
p = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = q = malloc (strlen (p) + 2);
|
r = q = malloc (strlen (p) + 2);
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (*p != '/') {
|
if (*p != '/') {
|
||||||
@ -484,8 +480,7 @@ static char *edit_canonicalize_pathname (const char *p)
|
|||||||
q++;
|
q++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (t)
|
g_free (t);
|
||||||
free (t);
|
|
||||||
*q = '\0';
|
*q = '\0';
|
||||||
/* get rid of trailing / */
|
/* get rid of trailing / */
|
||||||
if (r[0] && r[1])
|
if (r[0] && r[1])
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user