mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-03 04:26:52 +02:00
Add comment about template parameter to g_file_open_tmp() not being
modified. And correspondingly, remove unnecessary char buffer.
This commit is contained in:
parent
997215e747
commit
daa8fe28cd
11
gfileutils.c
11
gfileutils.c
@ -593,11 +593,14 @@ g_mkstemp (char *tmpl)
|
|||||||
* files (as returned by g_get_tmp_dir()).
|
* files (as returned by g_get_tmp_dir()).
|
||||||
*
|
*
|
||||||
* @template should be a string ending with six 'X' characters, as the
|
* @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
|
* functions, the template should only be a basename, no directory
|
||||||
* components are allowed. If template is NULL, a default template is
|
* components are allowed. If template is NULL, a default template is
|
||||||
* used.
|
* 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
|
* 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.
|
* 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)
|
GError **error)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
char mytemplate[10];
|
|
||||||
char *tmpdir;
|
char *tmpdir;
|
||||||
char *sep;
|
char *sep;
|
||||||
char *fulltemplate;
|
char *fulltemplate;
|
||||||
|
|
||||||
if (template == NULL)
|
if (template == NULL)
|
||||||
{
|
template = ".XXXXXX";
|
||||||
strcpy (mytemplate, ".XXXXXX");
|
|
||||||
template = mytemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strchr (template, G_DIR_SEPARATOR))
|
if (strchr (template, G_DIR_SEPARATOR))
|
||||||
{
|
{
|
||||||
|
@ -593,11 +593,14 @@ g_mkstemp (char *tmpl)
|
|||||||
* files (as returned by g_get_tmp_dir()).
|
* files (as returned by g_get_tmp_dir()).
|
||||||
*
|
*
|
||||||
* @template should be a string ending with six 'X' characters, as the
|
* @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
|
* functions, the template should only be a basename, no directory
|
||||||
* components are allowed. If template is NULL, a default template is
|
* components are allowed. If template is NULL, a default template is
|
||||||
* used.
|
* 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
|
* 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.
|
* 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)
|
GError **error)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
char mytemplate[10];
|
|
||||||
char *tmpdir;
|
char *tmpdir;
|
||||||
char *sep;
|
char *sep;
|
||||||
char *fulltemplate;
|
char *fulltemplate;
|
||||||
|
|
||||||
if (template == NULL)
|
if (template == NULL)
|
||||||
{
|
template = ".XXXXXX";
|
||||||
strcpy (mytemplate, ".XXXXXX");
|
|
||||||
template = mytemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strchr (template, G_DIR_SEPARATOR))
|
if (strchr (template, G_DIR_SEPARATOR))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user