Make utils_make_filename() return a copy for safety.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5709 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
45fe0eb088
commit
8523592d11
@ -11,6 +11,8 @@
|
||||
* src/filetypes.c, src/filetypes.h:
|
||||
Refactor with filetypes_get_filename().
|
||||
Make filetypes_get_conf_extension() static.
|
||||
* src/utils.c, src/utils.h, src/filetypes.c:
|
||||
Make utils_make_filename() return a copy for safety.
|
||||
|
||||
|
||||
2011-04-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
@ -31,7 +33,7 @@
|
||||
2011-04-08 Colomban Wendling <colomban(at)geany(dot)org>
|
||||
|
||||
* scintilla/lexers/LexCPP.cxx:
|
||||
Make hightlighting of triple-quoted verbatim an option (Backport
|
||||
Make highlighting of triple-quoted verbatim an option (Backport
|
||||
from Scintilla HG 3602:5536ed81a85b).
|
||||
* src/highlighting.c:
|
||||
Add highlight for triple-quoted verbatims.
|
||||
|
@ -1221,7 +1221,7 @@ static void add_keys(GKeyFile *dest, const gchar *group, GKeyFile *src)
|
||||
static gchar *filetypes_get_filename(GeanyFiletype *ft, gboolean user)
|
||||
{
|
||||
gchar *ext = filetypes_get_conf_extension(ft->id);
|
||||
const gchar *f;
|
||||
gchar *f;
|
||||
|
||||
if (user)
|
||||
f = utils_make_filename(app->configdir,
|
||||
@ -1230,7 +1230,7 @@ static gchar *filetypes_get_filename(GeanyFiletype *ft, gboolean user)
|
||||
f = utils_make_filename(app->datadir, "filetypes.", ext, NULL);
|
||||
|
||||
g_free(ext);
|
||||
return g_strdup(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1769,10 +1769,8 @@ const gchar *utils_build_path(const gchar *first, ...)
|
||||
* @param path A path, which will have a separator added before the other strings.
|
||||
* @param ... Strings to concatenate (no directory separators will be
|
||||
* inserted between them).
|
||||
* @warning This returns temporary string contents only valid until the next call
|
||||
* to this function.
|
||||
* E.g. filename = utils_make_filename(app->datadir, "filetypes.", ext, NULL); */
|
||||
const gchar *utils_make_filename(const gchar *path, ...)
|
||||
gchar *utils_make_filename(const gchar *path, ...)
|
||||
{
|
||||
static GString *buffer = NULL;
|
||||
va_list args;
|
||||
@ -1787,7 +1785,7 @@ const gchar *utils_make_filename(const gchar *path, ...)
|
||||
va_start(args, path);
|
||||
utils_string_vappend(buffer, NULL, args);
|
||||
va_end(args);
|
||||
return buffer->str;
|
||||
return g_strdup(buffer->str);
|
||||
}
|
||||
|
||||
|
||||
|
@ -249,7 +249,7 @@ gint utils_str_casecmp(const gchar *s1, const gchar *s2);
|
||||
|
||||
const gchar *utils_build_path(const gchar *first, ...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
const gchar *utils_make_filename(const gchar *path, ...) G_GNUC_NULL_TERMINATED;
|
||||
gchar *utils_make_filename(const gchar *path, ...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
gchar *utils_get_path_from_uri(const gchar *uri);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user