From: Tor Lillqvist Date: Fri, 10 Nov 2000 23:49:37 +0000 (+0000) Subject: Add comment about template parameter to g_file_open_tmp() not being X-Git-Tag: GLIB_1_3_2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=daa8fe28cd7aca4c9af5f36e354ee47ceb2c6ba1;p=platform%2Fupstream%2Fglib.git Add comment about template parameter to g_file_open_tmp() not being modified. And correspondingly, remove unnecessary char buffer. --- diff --git a/gfileutils.c b/gfileutils.c index e5cc56a..c8bb0a7 100644 --- a/gfileutils.c +++ b/gfileutils.c @@ -593,11 +593,14 @@ g_mkstemp (char *tmpl) * files (as returned by g_get_tmp_dir()). * * @template should be a string ending with six 'X' characters, as the - * parameter to g_mkstemp() (or mktemp()). However, unlike these + * parameter to g_mkstemp() (or mkstemp()). However, unlike these * functions, the template should only be a basename, no directory * components are allowed. If template is NULL, a default template is * used. * + * Note that in contrast to g_mkstemp() (and mkstemp()) @template is not + * modified, and might thus be a read-only literal string. + * * The actual name used is returned in @name_used if non-NULL. This * string should be freed with g_free when not needed any longer. * @@ -611,16 +614,12 @@ g_file_open_tmp (const char *template, GError **error) { int retval; - char mytemplate[10]; char *tmpdir; char *sep; char *fulltemplate; if (template == NULL) - { - strcpy (mytemplate, ".XXXXXX"); - template = mytemplate; - } + template = ".XXXXXX"; if (strchr (template, G_DIR_SEPARATOR)) { diff --git a/glib/gfileutils.c b/glib/gfileutils.c index e5cc56a..c8bb0a7 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -593,11 +593,14 @@ g_mkstemp (char *tmpl) * files (as returned by g_get_tmp_dir()). * * @template should be a string ending with six 'X' characters, as the - * parameter to g_mkstemp() (or mktemp()). However, unlike these + * parameter to g_mkstemp() (or mkstemp()). However, unlike these * functions, the template should only be a basename, no directory * components are allowed. If template is NULL, a default template is * used. * + * Note that in contrast to g_mkstemp() (and mkstemp()) @template is not + * modified, and might thus be a read-only literal string. + * * The actual name used is returned in @name_used if non-NULL. This * string should be freed with g_free when not needed any longer. * @@ -611,16 +614,12 @@ g_file_open_tmp (const char *template, GError **error) { int retval; - char mytemplate[10]; char *tmpdir; char *sep; char *fulltemplate; if (template == NULL) - { - strcpy (mytemplate, ".XXXXXX"); - template = mytemplate; - } + template = ".XXXXXX"; if (strchr (template, G_DIR_SEPARATOR)) {