Eliminate dup in fullfileof().

SVN revision: 36574
This commit is contained in:
Kim Woelders 2008-10-10 19:49:06 +00:00
parent 013d4f9620
commit 9acd352563
5 changed files with 10 additions and 10 deletions

View File

@ -1517,15 +1517,13 @@ BG_GetValues(void)
static void
BG_DialogSetFileName(DItem * di)
{
char *stmp = NULL;
const char *stmp;
char s[1024];
if (BackgroundGetBgFile(tmp_bg))
stmp = fullfileof(BackgroundGetBgFile(tmp_bg));
stmp = fullfileof(BackgroundGetBgFile(tmp_bg));
Esnprintf(s, sizeof(s),
_("Background definition information:\nName: %s\nFile: %s\n"),
BackgroundGetName(tmp_bg), (stmp) ? stmp : _("-NONE-"));
Efree(stmp);
DialogItemSetText(di, s);
}

View File

@ -267,13 +267,15 @@ fileof(const char *path)
return Estrndup(s1, s2 - s1);
}
char *
const char *
fullfileof(const char *path)
{
const char *s;
if (!path)
return NULL;
s = strrchr(path, '/');
return Estrdup((s) ? s + 1 : path);
return (s) ? s + 1 : path;
}
char *

View File

@ -56,7 +56,7 @@ int filedev(const char *s);
int isabspath(const char *s);
const char *fileext(const char *s);
char *fileof(const char *s);
char *fullfileof(const char *s);
const char *fullfileof(const char *s);
char *path_test(const char *file, unsigned int test);
int path_canexec(const char *file);

View File

@ -538,7 +538,8 @@ MenuLoadFromThemes(Menu * m)
{
char **lst;
int i, num;
char ss[4096], *s;
char ss[4096];
const char *s;
MenuItem *mi;
if (MenuGetTimestamp(m))
@ -551,7 +552,6 @@ MenuLoadFromThemes(Menu * m)
s = fullfileof(lst[i]);
Esnprintf(ss, sizeof(ss), "theme use %s", s);
mi = MenuItemCreate(s, NULL, ss, NULL);
Efree(s);
MenuAddItem(m, mi);
}
if (lst)

View File

@ -425,7 +425,7 @@ ThemePathFind(void)
}
Efree(Conf.theme.name);
Conf.theme.name = (theme) ? fullfileof(theme) : NULL;
Conf.theme.name = Estrdup(fullfileof(theme));
Efree(Mode.theme.path);
Mode.theme.path = (theme) ? theme : Estrdup("-");