This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 2f32c8dcf2211e0be4b323c53440c9349acc041e
Author: Xiang Xiao <[email protected]>
AuthorDate: Thu Apr 21 15:25:49 2022 +0800

    environ: Don't expose get_environ_ptr in csdlib
    
    since it isn't defined in c/c++ standard
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 include/cxx/cstdlib |  3 ---
 include/stdlib.h    | 10 +++++-----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/include/cxx/cstdlib b/include/cxx/cstdlib
index eace8b417a..8443f4f7b0 100644
--- a/include/cxx/cstdlib
+++ b/include/cxx/cstdlib
@@ -42,9 +42,6 @@ namespace std
 
   // Environment variable support
 
-#ifndef CONFIG_DISABLE_ENVIRON
-  using ::get_environ_ptr;
-#endif
   using ::getenv;
   using ::putenv;
   using ::clearenv;
diff --git a/include/stdlib.h b/include/stdlib.h
index d40d0e0fed..534dcb7db3 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -62,7 +62,11 @@
  * function call.  However, get_environ_ptr() can be used in its place.
  */
 
-#define environ get_environ_ptr()
+#ifdef CONFIG_DISABLE_ENVIRON
+#  define environ NULL
+#else
+#  define environ get_environ_ptr()
+#endif
 
 #if defined(CONFIG_FS_LARGEFILE) && defined(CONFIG_HAVE_LONG_LONG)
 #  define mkstemp64            mkstemp
@@ -138,11 +142,7 @@ void      arc4random_buf(FAR void *bytes, size_t nbytes);
 
 /* Environment variable support */
 
-#ifdef CONFIG_DISABLE_ENVIRON
-#  define get_environ_ptr() NULL
-#else
 FAR char **get_environ_ptr(void);
-#endif
 FAR char *getenv(FAR const char *name);
 int       putenv(FAR const char *string);
 int       clearenv(void);

Reply via email to