[前][次][番号順一覧][スレッド一覧]

ruby-changes:73648

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Wed, 21 Sep 2022 11:44:36 +0900 (JST)
Subject: [ruby-changes:73648] 437800d3b0 (master): getenv: is in stdlib.h

https://git.ruby-lang.org/ruby.git/commit/?id=437800d3b0

From 437800d3b0bdacf30b82fff15dd5532fbf65c3ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Wed, 21 Sep 2022 10:03:30 +0900
Subject: getenv: is in stdlib.h

getenv is a very basic function that has been in stdlib.h since
ISO/IEC 9899:1990.  There is absolutely zero need for us to redeclare.

pty.c already includes stdlib.h out of the box so we need nothing.
---
 ext/etc/etc.c | 8 ++++++--
 ext/pty/pty.c | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 4cd941f586..c355fe117a 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -47,8 +47,12 @@ static VALUE sGroup; https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L47
 #define HAVE_UNAME 1
 #endif
 
-#ifndef _WIN32
-char *getenv();
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
 #endif
 char *getlogin();
 
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 155d215942..acec33f9bf 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -170,7 +170,7 @@ establishShell(int argc, VALUE *argv, struct pty_info *info, https://github.com/ruby/ruby/blob/trunk/ext/pty/pty.c#L170
 {
     int 		master, slave, status = 0;
     rb_pid_t		pid;
-    char		*p, *getenv();
+    char		*p;
     VALUE		v;
     struct child_info   carg;
     char		errbuf[32];
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]