summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-06 07:00:23 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-06 07:00:23 -0600
commitd7adf70524254769f6e5a004d78ccf90965f70f6 (patch)
treebc0e20dc801e74506c4fa946b532e80b26468b5d /nuttx
parentee838563ae1484f45e8bb3361bb2e44fd117f615 (diff)
downloadpx4-nuttx-d7adf70524254769f6e5a004d78ccf90965f70f6.tar.gz
px4-nuttx-d7adf70524254769f6e5a004d78ccf90965f70f6.tar.bz2
px4-nuttx-d7adf70524254769f6e5a004d78ccf90965f70f6.zip
Can't use formal parameter name 'template' in stdlib.h. Causes C++ compilation errors. Noted by Lorenz Meier
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/include/cxx/cstdlib30
-rw-r--r--nuttx/include/stdlib.h4
-rw-r--r--nuttx/libc/stdlib/lib_mkstemp.c28
-rw-r--r--nuttx/libc/stdlib/lib_mktemp.c4
4 files changed, 48 insertions, 18 deletions
diff --git a/nuttx/include/cxx/cstdlib b/nuttx/include/cxx/cstdlib
index 1bf8ed9da..d7167d2e4 100644
--- a/nuttx/include/cxx/cstdlib
+++ b/nuttx/include/cxx/cstdlib
@@ -49,10 +49,15 @@
namespace std
{
+ // Random number generation
+
using ::srand;
using ::rand;
+ // Environment variable support
+
#ifndef CONFIG_DISABLE_ENIVRON
+ using ::get_environ_ptr;
using ::getenv;
using ::putenv;
using ::clearenv;
@@ -60,6 +65,8 @@ namespace std
using ::unsetenv;
#endif
+ // Process exit functions
+
using ::exit;
using ::abort;
#ifdef CONFIG_SCHED_ATEXIT
@@ -69,10 +76,22 @@ namespace std
using ::on_exit;
#endif
+ // String to binary conversions
+
using ::strtol;
using ::strtoul;
+#ifdef CONFIG_HAVE_LONG_LONG
+ using ::strtoll;
+ using ::strtoull;
+#endif
using ::strtod;
+ // Binary to string conversions
+
+ using ::itoa;
+
+ // Memory Management
+
using ::malloc;
using ::free;
using ::realloc;
@@ -80,6 +99,17 @@ namespace std
using ::zalloc;
using ::calloc;
using ::mallinfo;
+
+ // Misc.
+
+ using ::abs;
+ using ::labs;
+#ifdef CONFIG_HAVE_LONG_LONG
+ using ::llabs;
+#endif
+ using ::mktemp;
+ using ::mkstemp;
+ using ::qsort;
}
#endif // __INCLUDE_CXX_CSTDLIB
diff --git a/nuttx/include/stdlib.h b/nuttx/include/stdlib.h
index c149e0ac1..16a3f935b 100644
--- a/nuttx/include/stdlib.h
+++ b/nuttx/include/stdlib.h
@@ -182,8 +182,8 @@ long int labs(long int j);
#ifdef CONFIG_HAVE_LONG_LONG
long long int llabs(long long int j);
#endif
-int mktemp(FAR char *template);
-int mkstemp(FAR char *template);
+int mktemp(FAR char *path_template);
+int mkstemp(FAR char *path_template);
/* Sorting */
diff --git a/nuttx/libc/stdlib/lib_mkstemp.c b/nuttx/libc/stdlib/lib_mkstemp.c
index 3269463f5..729dfa535 100644
--- a/nuttx/libc/stdlib/lib_mkstemp.c
+++ b/nuttx/libc/stdlib/lib_mkstemp.c
@@ -195,18 +195,18 @@ static void copy_base62(FAR char *dest, int len)
*
* Description:
* The mkstemp() function replaces the contents of the string pointed to
- * by template by a unique filename, and returns a file descriptor for the
- * file open for reading and writing. The function thus prevents any
- * possible race condition between testing whether the file exists and
- * opening it for use. The string in template should look like a filename
- * with six trailing 'X' s; mkstemp() replaces each 'X' with a character
- * from the portable filename character set. The characters are chosen
- * such that the resulting name does not duplicate the name of an existing
- * file at the time of a call to mkstemp().
+ * by path_template by a unique filename, and returns a file descriptor
+ * for the file open for reading and writing. The function thus prevents
+ * any possible race condition between testing whether the file exists and
+ * opening it for use. The string in path_template should look like a
+ * filename with six trailing 'X' s; mkstemp() replaces each 'X' with a
+ * character from the portable filename character set. The characters are
+ * chosen such that the resulting name does not duplicate the name of an
+ * existing file at the time of a call to mkstemp().
*
* Input Parameters:
- * template - The base file name that will be modified to produce the
- * unique file name. This must be a full path beginning with /tmp.
+ * path_template - The base file name that will be modified to produce
+ * the unique file name. This must be a full path beginning with /tmp.
* This function will modify only the first XXXXXX characters within
* that full path.
*
@@ -217,7 +217,7 @@ static void copy_base62(FAR char *dest, int len)
*
****************************************************************************/
-int mkstemp(FAR char *template)
+int mkstemp(FAR char *path_template)
{
uint8_t base62[MAX_XS];
uint32_t retries;
@@ -229,12 +229,12 @@ int mkstemp(FAR char *template)
/* Count the number of X's at the end of the template */
- xptr = strchr(template, 'X');
+ xptr = strchr(path_template, 'X');
if (!xptr)
{
/* No Xs? There should always really be 6 */
- return open(template, O_RDWR | O_CREAT | O_EXCL, 0666);
+ return open(path_template, O_RDWR | O_CREAT | O_EXCL, 0666);
}
/* There is at least one.. count all of them */
@@ -279,7 +279,7 @@ int mkstemp(FAR char *template)
* directories
*/
- fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0666);
+ fd = open(path_template, O_RDWR | O_CREAT | O_EXCL, 0666);
if (fd >= 0)
{
/* We have it... return the file descriptor */
diff --git a/nuttx/libc/stdlib/lib_mktemp.c b/nuttx/libc/stdlib/lib_mktemp.c
index 705c5cb9e..2559f99cb 100644
--- a/nuttx/libc/stdlib/lib_mktemp.c
+++ b/nuttx/libc/stdlib/lib_mktemp.c
@@ -65,9 +65,9 @@
*
****************************************************************************/
-int mktemp(FAR char *template)
+int mktemp(FAR char *path_template)
{
- int fd = mkstemp(template);
+ int fd = mkstemp(path_template);
if (fd < 0)
{
return ERROR;