mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
93880659c0
commit
83c5219287
2 changed files with 15 additions and 0 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Mon Nov 1 21:25:57 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||
|
||||
* 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@atdot.net>
|
||||
|
||||
* gc.c (finalizer_table, objspace->final.table):
|
||||
|
|
3
main.c
3
main.c
|
@ -15,6 +15,9 @@
|
|||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#ifdef RUBY_DEBUG_ENV
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
RUBY_GLOBAL_SETUP
|
||||
|
||||
|
|
Loading…
Reference in a new issue