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

ruby-changes:17650

From: shyouhei <ko1@a...>
Date: Mon, 1 Nov 2010 21:51:33 +0900 (JST)
Subject: [ruby-changes:17650] Ruby:r29658 (trunk): * main.c: <stdlib.h> is needed, to introduce the getenv(3)

shyouhei	2010-11-01 21:43:59 +0900 (Mon, 01 Nov 2010)

  New Revision: 29658

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29658

  Log:
    * main.c: <stdlib.h> is needed, to introduce the getenv(3)
      prototype declaration.  Without it a C compiler shall infer
      the getenv type as "int getenv(...);", but this is totally
      wrong, especially when your machine's sizeof(int) and
      sizeof(char*) differs.  On such environment a return value
      of getenv(3), which is in fact a char*, might first casted
      into a int (loses data here), and then casted back to char*
      by automatic integral promotion fo fit to the prototype of
      ruby_set_debug_option().

  Modified files:
    trunk/ChangeLog
    trunk/main.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29657)
+++ ChangeLog	(revision 29658)
@@ -1,3 +1,15 @@
+Mon Nov  1 21:25:57 2010  URABE Shyouhei  <shyouhei@r...>
+
+	* main.c: <stdlib.h> is needed, to introduce the getenv(3)
+          prototype declaration.  Without it a C compiler shall infer
+          the getenv type as "int getenv(...);", but this is totally
+          wrong, especially when your machine's sizeof(int) and
+          sizeof(char*) differs.  On such environment a return value
+          of getenv(3), which is in fact a char*, might first casted
+          into a int (loses data here), and then casted back to char*
+          by automatic integral promotion fo fit to the prototype of
+          ruby_set_debug_option().
+
 Sun Oct 31 23:27:09 2010  Koichi Sasada  <ko1@a...>
 
 	* gc.c (finalizer_table, objspace->final.table):
Index: main.c
===================================================================
--- main.c	(revision 29657)
+++ main.c	(revision 29658)
@@ -15,6 +15,9 @@
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
 #endif
+#ifdef RUBY_DEBUG_ENV
+#include <stdlib.h>
+#endif
 
 RUBY_GLOBAL_SETUP
 

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

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