Commit a890fbef authored by David Lawrence's avatar David Lawrence
Browse files

C++ reserves the word "template"; use "templet" as the parameter to

isc_file_openunique
parent 37cc3f59
...@@ -91,11 +91,15 @@ isc_file_mktemplate(const char *path, char *buf, size_t buflen); ...@@ -91,11 +91,15 @@ isc_file_mktemplate(const char *path, char *buf, size_t buflen);
*/ */
isc_result_t isc_result_t
isc_file_openunique(char *template, FILE **fp); isc_file_openunique(char *templet, FILE **fp);
/* /*
* Create and open a file with a unique name based on 'template'. * Create and open a file with a unique name based on 'templet'.
* *
* Notes: * Notes:
* 'template' is a reserved work in C++. If you want to complain
* about the spelling of 'templet', first look it up in the
* Merriam-Webster English dictionary. (http://www.m-w.com/)
*
* This function works by using the template to generate file names. * This function works by using the template to generate file names.
* The template must be a writable string, as it is modified in place. * The template must be a writable string, as it is modified in place.
* Trailing X characters in the file name (full file name on Unix, * Trailing X characters in the file name (full file name on Unix,
......
...@@ -116,18 +116,18 @@ isc_file_mktemplate(const char *path, char *buf, size_t buflen) { ...@@ -116,18 +116,18 @@ isc_file_mktemplate(const char *path, char *buf, size_t buflen) {
} }
isc_result_t isc_result_t
isc_file_openunique(char *template, FILE **fp) { isc_file_openunique(char *templet, FILE **fp) {
int fd; int fd;
FILE *f; FILE *f;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
REQUIRE(template != NULL); REQUIRE(templet != NULL);
REQUIRE(fp != NULL && *fp == NULL); REQUIRE(fp != NULL && *fp == NULL);
/* /*
* Win32 does not have mkstemp. * Win32 does not have mkstemp.
*/ */
fd = mkstemp(template); fd = mkstemp(templet);
if (fd == -1) if (fd == -1)
switch (errno) { switch (errno) {
...@@ -158,7 +158,7 @@ isc_file_openunique(char *template, FILE **fp) { ...@@ -158,7 +158,7 @@ isc_file_openunique(char *template, FILE **fp) {
else else
result = ISC_R_UNEXPECTED; result = ISC_R_UNEXPECTED;
(void)remove(template); (void)remove(templet);
(void)close(fd); (void)close(fd);
} else } else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment