summaryrefslogtreecommitdiff
path: root/nuttx/libc
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/libc')
-rw-r--r--nuttx/libc/lib_internal.h16
-rw-r--r--nuttx/libc/misc/lib_sendfile.c8
-rw-r--r--nuttx/libc/spawn/lib_psfa_addclose.c4
-rw-r--r--nuttx/libc/spawn/lib_psfa_adddup2.c4
-rw-r--r--nuttx/libc/spawn/lib_psfa_addopen.c5
-rw-r--r--nuttx/libc/spawn/lib_psfa_destroy.c4
-rw-r--r--nuttx/libc/stdio/lib_asprintf.c2
-rw-r--r--nuttx/libc/stdio/lib_libdtoa.c4
-rw-r--r--nuttx/libc/string/lib_strdup.c3
9 files changed, 39 insertions, 11 deletions
diff --git a/nuttx/libc/lib_internal.h b/nuttx/libc/lib_internal.h
index 17adff417..76a37de0d 100644
--- a/nuttx/libc/lib_internal.h
+++ b/nuttx/libc/lib_internal.h
@@ -104,10 +104,19 @@
* Public Variables
****************************************************************************/
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
/* Debug output is initially disabled */
#ifdef CONFIG_SYSLOG_ENABLE
-extern bool g_syslogenable;
+EXTERN bool g_syslogenable;
#endif
/****************************************************************************
@@ -200,4 +209,9 @@ double lib_expi(size_t n);
float lib_sqrtapprox(float x);
#endif
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __LIB_LIB_INTERNAL_H */
diff --git a/nuttx/libc/misc/lib_sendfile.c b/nuttx/libc/misc/lib_sendfile.c
index 8a38dc317..f66c30918 100644
--- a/nuttx/libc/misc/lib_sendfile.c
+++ b/nuttx/libc/misc/lib_sendfile.c
@@ -1,7 +1,7 @@
/************************************************************************
* libc/misc/lib_streamsem.c
*
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2009, 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -45,6 +45,8 @@
#include <unistd.h>
#include <errno.h>
+#include "lib_internal.h"
+
#if CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0
/************************************************************************
@@ -143,7 +145,7 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count)
/* Allocate an I/O buffer */
- iobuffer = (FAR void *)malloc(CONFIG_LIB_SENDFILE_BUFSIZE);
+ iobuffer = (FAR void *)lib_malloc(CONFIG_LIB_SENDFILE_BUFSIZE);
if (!iobuffer)
{
set_errno(ENOMEM);
@@ -261,7 +263,7 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count)
/* Release the I/O buffer */
- free(iobuffer);
+ lib_free(iobuffer);
/* Return the current file position */
diff --git a/nuttx/libc/spawn/lib_psfa_addclose.c b/nuttx/libc/spawn/lib_psfa_addclose.c
index 1c72f0f82..4f813f65c 100644
--- a/nuttx/libc/spawn/lib_psfa_addclose.c
+++ b/nuttx/libc/spawn/lib_psfa_addclose.c
@@ -46,6 +46,8 @@
#include <nuttx/spawn.h>
+#include "lib_internal.h"
+
/****************************************************************************
* Global Functions
****************************************************************************/
@@ -81,7 +83,7 @@ int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actio
/* Allocate the action list entry */
entry = (FAR struct spawn_close_file_action_s *)
- zalloc(sizeof(struct spawn_close_file_action_s));
+ lib_zalloc(sizeof(struct spawn_close_file_action_s));
if (!entry)
{
diff --git a/nuttx/libc/spawn/lib_psfa_adddup2.c b/nuttx/libc/spawn/lib_psfa_adddup2.c
index deb3cbdb3..a10f476f1 100644
--- a/nuttx/libc/spawn/lib_psfa_adddup2.c
+++ b/nuttx/libc/spawn/lib_psfa_adddup2.c
@@ -46,6 +46,8 @@
#include <nuttx/spawn.h>
+#include "lib_internal.h"
+
/****************************************************************************
* Global Functions
****************************************************************************/
@@ -84,7 +86,7 @@ int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_action
/* Allocate the action list entry */
entry = (FAR struct spawn_dup2_file_action_s *)
- zalloc(sizeof(struct spawn_close_file_action_s));
+ lib_zalloc(sizeof(struct spawn_close_file_action_s));
if (!entry)
{
diff --git a/nuttx/libc/spawn/lib_psfa_addopen.c b/nuttx/libc/spawn/lib_psfa_addopen.c
index 66bbd813a..d9f5b849f 100644
--- a/nuttx/libc/spawn/lib_psfa_addopen.c
+++ b/nuttx/libc/spawn/lib_psfa_addopen.c
@@ -47,6 +47,8 @@
#include <nuttx/spawn.h>
+#include "lib_internal.h"
+
/****************************************************************************
* Global Functions
****************************************************************************/
@@ -97,8 +99,7 @@ int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_action
/* Allocate the action list entry of this size */
- entry = (FAR struct spawn_open_file_action_s *)zalloc(alloc);
-
+ entry = (FAR struct spawn_open_file_action_s *)lib_zalloc(alloc);
if (!entry)
{
return ENOMEM;
diff --git a/nuttx/libc/spawn/lib_psfa_destroy.c b/nuttx/libc/spawn/lib_psfa_destroy.c
index a21886645..d80dbd978 100644
--- a/nuttx/libc/spawn/lib_psfa_destroy.c
+++ b/nuttx/libc/spawn/lib_psfa_destroy.c
@@ -45,6 +45,8 @@
#include <nuttx/spawn.h>
+#include "lib_internal.h"
+
/****************************************************************************
* Global Functions
****************************************************************************/
@@ -86,7 +88,7 @@ int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_action
/* Get the pointer to the next element before destroying the current one */
next = curr->flink;
- free(curr);
+ lib_free(curr);
}
/* Mark the list empty */
diff --git a/nuttx/libc/stdio/lib_asprintf.c b/nuttx/libc/stdio/lib_asprintf.c
index 20ca6de32..c08d7360a 100644
--- a/nuttx/libc/stdio/lib_asprintf.c
+++ b/nuttx/libc/stdio/lib_asprintf.c
@@ -40,6 +40,8 @@
#include <stdio.h>
#include <stdarg.h>
+#include "lib_internal.h"
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
diff --git a/nuttx/libc/stdio/lib_libdtoa.c b/nuttx/libc/stdio/lib_libdtoa.c
index 29f61fd76..a9a86817c 100644
--- a/nuttx/libc/stdio/lib_libdtoa.c
+++ b/nuttx/libc/stdio/lib_libdtoa.c
@@ -44,6 +44,8 @@
* Included Files
****************************************************************************/
+#include "lib_internal.h"
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -293,7 +295,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec,
#if 0
if (digalloc)
{
- free(digalloc);
+ lib_free(digalloc);
}
#endif
}
diff --git a/nuttx/libc/string/lib_strdup.c b/nuttx/libc/string/lib_strdup.c
index a5b3a1e8c..38eed709c 100644
--- a/nuttx/libc/string/lib_strdup.c
+++ b/nuttx/libc/string/lib_strdup.c
@@ -1,7 +1,7 @@
/************************************************************************
* libc/string//lib_strdup.c
*
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2009, 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -58,5 +58,6 @@ FAR char *strdup(const char *s)
strcpy(news, s);
}
}
+
return news;
}