[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mkostemps
From: |
Eric Blake |
Subject: |
Re: mkostemps |
Date: |
Tue, 17 Nov 2009 22:17:42 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 11/4/2009 7:18 PM:
> According to Eric Blake on 11/2/2009 4:18 PM:
>> Now that glibc 2.11 offers mkostemps, we should too. Any objections to this
>> patch series?
>
> No comments, so I went ahead and pushed this.
One more followup - don't interfere with C++ compilation.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAksDg3UACgkQ84KuGfSFAYB/ggCaA5QIVBfY+EBH++lC7zVCsuJp
9IkAmwa9s9GX3bmFB4jisjPrDfyb7fiO
=Ee1W
-----END PGP SIGNATURE-----
>From 83e045030538b7838367305c0b92c7c756c90651 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 17 Nov 2009 11:53:14 -0700
Subject: [PATCH] mkstemp: avoid conflict with C++ keyword template
Just because glibc uses K&R, and uses template as an identifier,
doesn't mean we have to.
* lib/mkdtemp.c (mkdtemp): Change spelling of template.
* lib/mkostemp.c (mkostemp): Likewise.
* lib/mkostemps.c (mkostemps): Likewise.
* lib/mkstemp.c (mkstemp): Likewise.
* lib/mkstemps.c (mkstemps): Likewise.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 7 +++++++
lib/mkdtemp.c | 10 +++++-----
lib/mkostemp.c | 10 ++++------
lib/mkostemps.c | 11 ++++-------
lib/mkstemp.c | 9 ++++-----
lib/mkstemps.c | 10 ++++------
6 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2889727..64b11d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-11-17 Eric Blake <address@hidden>
+ mkstemp: avoid conflict with C++ keyword template
+ * lib/mkdtemp.c (mkdtemp): Change spelling of template.
+ * lib/mkostemp.c (mkostemp): Likewise.
+ * lib/mkostemps.c (mkostemps): Likewise.
+ * lib/mkstemp.c (mkstemp): Likewise.
+ * lib/mkstemps.c (mkstemps): Likewise.
+
xalloc-die-tests: optimize
* tests/test-xalloc-die.sh: Reduce number of processes.
diff --git a/lib/mkdtemp.c b/lib/mkdtemp.c
index 7f07ee4..2a71f77 100644
--- a/lib/mkdtemp.c
+++ b/lib/mkdtemp.c
@@ -23,16 +23,16 @@
#include "tempname.h"
-/* Generate a unique temporary directory from TEMPLATE.
- The last six characters of TEMPLATE must be "XXXXXX";
+/* Generate a unique temporary directory from XTEMPLATE.
+ The last six characters of XTEMPLATE must be "XXXXXX";
they are replaced with a string that makes the filename unique.
The directory is created, mode 700, and its name is returned.
(This function comes from OpenBSD.) */
char *
-mkdtemp (char *template)
+mkdtemp (char *xtemplate)
{
- if (gen_tempname (template, 0, 0, GT_DIR))
+ if (gen_tempname (xtemplate, 0, 0, GT_DIR))
return NULL;
else
- return template;
+ return xtemplate;
}
diff --git a/lib/mkostemp.c b/lib/mkostemp.c
index 02a97e6..cdf758f 100644
--- a/lib/mkostemp.c
+++ b/lib/mkostemp.c
@@ -35,14 +35,12 @@
# define __GT_FILE 0
#endif
-/* Generate a unique temporary file name from TEMPLATE.
- The last six characters of TEMPLATE must be "XXXXXX";
+/* Generate a unique temporary file name from XTEMPLATE.
+ The last six characters of XTEMPLATE must be "XXXXXX";
they are replaced with a string that makes the file name unique.
Then open the file and return a fd. */
int
-mkostemp (template, flags)
- char *template;
- int flags;
+mkostemp (char *xtemplate, int flags)
{
- return __gen_tempname (template, 0, flags, __GT_FILE);
+ return __gen_tempname (xtemplate, 0, flags, __GT_FILE);
}
diff --git a/lib/mkostemps.c b/lib/mkostemps.c
index 8de90fe..98475ff 100644
--- a/lib/mkostemps.c
+++ b/lib/mkostemps.c
@@ -37,15 +37,12 @@
# define __GT_FILE 0
#endif
-/* Generate a unique temporary file name from TEMPLATE. The last six
- characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+/* Generate a unique temporary file name from XTEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of XTEMPLATE must be
"XXXXXX"; they are replaced with a string that makes the filename
unique. Then open the file and return a fd. */
int
-mkostemps (template, suffixlen, flags)
- char *template;
- int suffixlen;
- int flags;
+mkostemps (char *xtemplate, int suffixlen, int flags)
{
if (suffixlen < 0)
{
@@ -53,5 +50,5 @@ mkostemps (template, suffixlen, flags)
return -1;
}
- return __gen_tempname (template, suffixlen, flags, __GT_FILE);
+ return __gen_tempname (xtemplate, suffixlen, flags, __GT_FILE);
}
diff --git a/lib/mkstemp.c b/lib/mkstemp.c
index 684c983..dda0400 100644
--- a/lib/mkstemp.c
+++ b/lib/mkstemp.c
@@ -35,13 +35,12 @@
# define __GT_FILE 0
#endif
-/* Generate a unique temporary file name from TEMPLATE.
- The last six characters of TEMPLATE must be "XXXXXX";
+/* Generate a unique temporary file name from XTEMPLATE.
+ The last six characters of XTEMPLATE must be "XXXXXX";
they are replaced with a string that makes the file name unique.
Then open the file and return a fd. */
int
-mkstemp (template)
- char *template;
+mkstemp (char *xtemplate)
{
- return __gen_tempname (template, 0, 0, __GT_FILE);
+ return __gen_tempname (xtemplate, 0, 0, __GT_FILE);
}
diff --git a/lib/mkstemps.c b/lib/mkstemps.c
index 5ce1697..31db5e0 100644
--- a/lib/mkstemps.c
+++ b/lib/mkstemps.c
@@ -37,14 +37,12 @@
# define __GT_FILE 0
#endif
-/* Generate a unique temporary file name from TEMPLATE. The last six
- characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+/* Generate a unique temporary file name from XTEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of XTEMPLATE must be
"XXXXXX"; they are replaced with a string that makes the filename
unique. Then open the file and return a fd. */
int
-mkstemps (template, suffixlen)
- char *template;
- int suffixlen;
+mkstemps (char *xtemplate, int suffixlen)
{
if (suffixlen < 0)
{
@@ -52,5 +50,5 @@ mkstemps (template, suffixlen)
return -1;
}
- return __gen_tempname (template, suffixlen, 0, __GT_FILE);
+ return __gen_tempname (xtemplate, suffixlen, 0, __GT_FILE);
}
--
1.6.5.rc1