1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/tk/tkutil/extronf.rb: check stdndup() because it's not standard

function of C.

	* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): use malloc() and
	  strncpy() instead of strndup() if not available.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2008-05-14 08:16:51 +00:00
parent d37d14c0a5
commit e9d69ca0ce
4 changed files with 21 additions and 3 deletions

View file

@ -1,3 +1,11 @@
Wed May 14 17:15:11 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/tk/tkutil/extronf.rb: check stdndup() because it's not standard
function of C.
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): use malloc() and
strncpy() instead of strndup() if not available.
Wed May 14 09:52:02 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/tkutil/tkutil.c: improve handling callback-subst-keys.

View file

@ -8,5 +8,6 @@ end
if has_tk
require 'mkmf'
have_func("rb_obj_instance_exec", "ruby.h")
have_func("strndup", "string.h")
create_makefile('tkutil')
end

View file

@ -1522,8 +1522,17 @@ cbsubst_table_setup(argc, argv, self)
chr = (unsigned char)(0x80 + idx);
subst_inf->keylen[chr] = RSTRING_LEN(RARRAY_PTR(inf)[0]);
#if HAVE_STRNDUP
subst_inf->key[chr] = strndup(RSTRING_PTR(RARRAY_PTR(inf)[0]),
RSTRING_LEN(RARRAY_PTR(inf)[0]));
#else
subst_inf->key[chr] = malloc(RSTRING_LEN(RARRAY_PTR(inf)[0]) + 1);
if (subst_inf->key[chr]) {
strncpy(subst_inf->key[chr], RSTRING_PTR(RARRAY_PTR(inf)[0]),
RSTRING_LEN(RARRAY_PTR(inf)[0]) + 1);
subst_inf->key[chr][RSTRING_LEN(RARRAY_PTR(inf)[0])] = '\0';
}
#endif
if (TYPE(RARRAY_PTR(inf)[1]) == T_STRING) {
subst_inf->type[chr] = *(RSTRING_PTR(RARRAY_PTR(inf)[1]));
} else {

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.7"
#define RUBY_RELEASE_DATE "2008-05-13"
#define RUBY_RELEASE_DATE "2008-05-14"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20080513
#define RUBY_RELEASE_CODE 20080514
#define RUBY_PATCHLEVEL 5000
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 13
#define RUBY_RELEASE_DAY 14
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];