mkstemp: avoid conflict with C++ keyword template
authorEric Blake <ebb9@byu.net>
Tue, 17 Nov 2009 18:53:14 +0000 (11:53 -0700)
committerEric Blake <ebb9@byu.net>
Wed, 18 Nov 2009 05:15:29 +0000 (22:15 -0700)
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 <ebb9@byu.net>
ChangeLog
lib/mkdtemp.c
lib/mkostemp.c
lib/mkostemps.c
lib/mkstemp.c
lib/mkstemps.c

index 28897271b0fbb883c30427d52eec4a3101c131a5..64b11d23e15b6b4a8c0d6cd0b62270b3ed20941b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-11-17  Eric Blake  <ebb9@byu.net>
 
+       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.
 
index 7f07ee4fdf500245b5fc1af16959ca9f0e14b401..2a71f77416e03719e8e1ec6eef7927222e7483d1 100644 (file)
 
 #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;
 }
index 02a97e6629ccf3a3b5b8cfaa47ef42d6930af18f..cdf758f270ca801a5f052313c4b54011398e5fe3 100644 (file)
 # 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);
 }
index 8de90fe2b2a76ed7994660b06226214cca5be8b5..98475ff5e961442333e3a3f200edad45c85db71d 100644 (file)
 # 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);
 }
index 684c98331cefa1db37f0b06ff208e7b675f358f6..dda0400948ffc7260219a8da3c61b847eee1171f 100644 (file)
 # 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);
 }
index 5ce16973532248dfa0e3f7ca26e298d38d09a540..31db5e09591474659c4b6f2cb882c08b3cfcd98c 100644 (file)
 # 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);
 }