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

* ext/tk/extconf.rb: fix [ruby-core:28901] [Bug #2997]. Thanks, Michael Graff.

* ext/tk/tcltklib.c: use xfree() for memories allocated by ALLOC().
* ext/tk/tkutil/tkutil.c: ditto.
* ext/tk/lib/tkextlib/version.rb: forgot updating.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2010-03-25 19:55:32 +00:00
parent 77891d864f
commit 9e415266a8
5 changed files with 55 additions and 37 deletions

View file

@ -1,3 +1,14 @@
Fri Mar 26 04:52:19 2010 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/extconf.rb: fix [ruby-core:28901] [Bug #2997].
Thanks, Michael Graff.
* ext/tk/tcltklib.c: use xfree() for memories allocated by ALLOC().
* ext/tk/tkutil/tkutil.c: ditto.
* ext/tk/lib/tkextlib/version.rb: forgot updating.
Thu Mar 25 23:53:22 2010 wanabe <s.wanabe@gmail.com>
* thread.c (thread_reset_event_flags): set flags to thread. [Bug #693]

View file

@ -1,6 +1,6 @@
##############################################################
# extconf.rb for tcltklib
# release date: 2009-08-09
# release date: 2010-03-26
##############################################################
require 'mkmf'
@ -999,7 +999,7 @@ def find_tcltk_header(tclver, tkver)
end
if TkConfig_Info['TK_INCLUDE_SPEC'] &&
have_tk_h = try_cpp('tk.h', TclConfig_Info['TK_INCLUDE_SPEC'])
have_tk_h = try_cpp('tk.h', TkConfig_Info['TK_INCLUDE_SPEC'])
$INCFLAGS << " " << TkConfig_Info['TK_INCLUDE_SPEC']
elsif have_tk_h = have_header('tk.h')
# find
@ -1026,12 +1026,12 @@ def setup_for_macosx_framework
if File.exist?(dir = File.join(TkLib_Config["tcltk-framework"],
'Tcl.framework', 'Headers'))
TclConfig_Info['TCL_INCLUDE_SPEC'] = "-I#{dir} "
TclConfig_Info['TK_INCLUDE_SPEC'] = "-I#{File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', 'Headers')} "
TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', 'Headers')} "
else
dir = Dir.glob(File.join(TkLib_Config["tcltk-framework"],
'Tcl.framework', '*', 'Headers'))
TclConfig_Info['TCL_INCLUDE_SPEC'] = "-I#{dir[0]} " unless dir.empty?
TclConfig_Info['TK_INCLUDE_SPEC'] = "-I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'))[0]} "
TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'))[0]} "
end
$LDFLAGS << ' -framework Tk -framework Tcl'
@ -1084,6 +1084,11 @@ def search_X_libraries
puts("Can't find X11 libraries. So, can't make tcltklib.so which is required by Ruby/Tk.")
exit
end
if TkConfig_Info['TK_XINCLUDES'] &&
!TkConfig_Info['TK_XINCLUDES'].strip.empty?
$INCFLAGS << " " << TkConfig_Info['TK_XINCLUDES'].strip
end
end
use_X
@ -1400,8 +1405,8 @@ if (TkLib_Config["tcltk-framework"] ||
$INSTALLFILES << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"]
# create
$defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"]
$defs << %[-DRUBY_RELEASE_DATE=\\"#{RUBY_RELEASE_DATE}\\"]
$CPPFLAGS << %[ -DRUBY_VERSION=\\"#{RUBY_VERSION}\\"]
$CPPFLAGS << %[ -DRUBY_RELEASE_DATE=\\"#{RUBY_RELEASE_DATE}\\"]
create_makefile("tcltklib")

View file

@ -2,5 +2,5 @@
# release date of tkextlib
#
module Tk
Tkextlib_RELEASE_DATE = '2009-07-12'.freeze
Tkextlib_RELEASE_DATE = '2010-02-01'.freeze
end

View file

@ -4,16 +4,18 @@
* Oct. 24, 1997 Y. Matsumoto
*/
#define TCLTKLIB_RELEASE_DATE "2009-10-27"
#define TCLTKLIB_RELEASE_DATE "2010-03-26"
#include "ruby.h"
#ifdef HAVE_RUBY_ENCODING_H
#include "ruby/encoding.h"
#endif
#ifndef HAVE_RUBY_RUBY_H
#undef RUBY_RELEASE_DATE
#include "version.h"
#ifndef RUBY_VERSION
#define RUBY_VERSION "(unknown version)"
#endif
#ifndef RUBY_RELEASE_DATE
#define RUBY_RELEASE_DATE "unknown release-date"
#endif
#ifdef RUBY_VM
@ -1064,7 +1066,7 @@ call_original_exit(ptr, state)
Tcl_DecrRefCount(cmd_obj);
#if USE_RUBY_ALLOC
free(argv);
xfree(argv);
#else /* not USE_RUBY_ALLOC */
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)argv, TCL_DYNAMIC); /* XXXXXXXX */
@ -1099,7 +1101,7 @@ call_original_exit(ptr, state)
ptr->return_value = (*(info->proc))(info->clientData, ptr->ip, 2, argv);
#if USE_RUBY_ALLOC
free(argv);
xfree(argv);
#else /* not USE_RUBY_ALLOC */
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)argv, TCL_DYNAMIC); /* XXXXXXXX */
@ -1138,7 +1140,7 @@ call_original_exit(ptr, state)
2, argv);
#if USE_RUBY_ALLOC
free(argv);
xfree(argv);
#else /* not USE_RUBY_ALLOC */
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)argv, TCL_DYNAMIC); /* XXXXXXXX */
@ -2158,7 +2160,7 @@ lib_eventloop_ensure(args)
rb_thread_critical = ptr->thr_crit_bup;
free(ptr);
xfree(ptr);
/* ckfree((char*)ptr); */
return Qnil;
@ -2201,7 +2203,7 @@ lib_eventloop_ensure(args)
rb_thread_critical = ptr->thr_crit_bup;
free(ptr);
xfree(ptr);
/* ckfree((char*)ptr);*/
DUMP2("finish current eventloop %lx", current_evloop);
@ -2523,8 +2525,8 @@ lib_thread_callback(argc, argv, self)
ret = rb_protect(_thread_call_proc_value, th, &status);
}
free(q->done);
free(q);
xfree(q->done);
xfree(q);
/* ckfree((char*)q->done); */
/* ckfree((char*)q); */
@ -2674,7 +2676,7 @@ ip_set_exc_message(interp, exc)
Tcl_AppendResult(interp, Tcl_DStringValue(&dstr), (char*)NULL);
DUMP2("error message:%s", Tcl_DStringValue(&dstr));
Tcl_DStringFree(&dstr);
free(buf);
xfree(buf);
/* ckfree(buf); */
#else /* TCL_VERSION <= 8.0 */
@ -2803,7 +2805,7 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
/* buf = ckalloc(sizeof(char) * 256); */
sprintf(buf, "unknown loncaljmp status %d", status);
exc = rb_exc_new2(rb_eException, buf);
free(buf);
xfree(buf);
/* ckfree(buf); */
break;
}
@ -2992,7 +2994,7 @@ ip_ruby_eval(clientData, interp, argc, argv)
code = tcl_protect(interp, rb_eval_string, (VALUE)arg);
#if TCL_MAJOR_VERSION >= 8
free(arg);
xfree(arg);
/* ckfree(arg); */
#endif
@ -3105,7 +3107,7 @@ ip_ruby_cmd_receiver_get(str)
memcpy(buf + 1, str, len);
buf[len + 1] = 0;
receiver = rb_gv_get(buf);
free(buf);
xfree(buf);
/* ckfree(buf); */
}
@ -3227,7 +3229,7 @@ ip_ruby_cmd(clientData, interp, argc, argv)
/* evaluate the argument string by ruby */
code = tcl_protect(interp, ip_ruby_cmd_core, (VALUE)arg);
free(arg);
xfree(arg);
/* ckfree((char*)arg); */
return code;
@ -5371,7 +5373,7 @@ ip_free(ptr)
(unsigned long)Tcl_GetMaster(ptr->ip));
DUMP2("slave IP(%lx) should not be deleted",
(unsigned long)ptr->ip);
free(ptr);
xfree(ptr);
/* ckfree((char*)ptr); */
rb_thread_critical = thr_crit_bup;
return;
@ -5379,7 +5381,7 @@ ip_free(ptr)
if (ptr->ip == (Tcl_Interp*)NULL) {
DUMP1("ip_free is called for deleted IP");
free(ptr);
xfree(ptr);
/* ckfree((char*)ptr); */
rb_thread_critical = thr_crit_bup;
return;
@ -5393,7 +5395,7 @@ ip_free(ptr)
}
ptr->ip = (Tcl_Interp*)NULL;
free(ptr);
xfree(ptr);
/* ckfree((char*)ptr); */
rb_thread_critical = thr_crit_bup;
@ -7585,7 +7587,7 @@ lib_toUTF8_core(ip_obj, src, encodename)
*/
Tcl_DStringFree(&dstr);
free(buf);
xfree(buf);
/* ckfree(buf); */
rb_thread_critical = thr_crit_bup;
@ -7787,7 +7789,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
*/
Tcl_DStringFree(&dstr);
free(buf);
xfree(buf);
/* ckfree(buf); */
rb_thread_critical = thr_crit_bup;
@ -9572,7 +9574,7 @@ tcltklib_compile_info()
ret = rb_obj_freeze(rb_str_new2(info));
free(info);
xfree(info);
/* ckfree(info); */
return ret;

View file

@ -7,7 +7,7 @@
************************************************/
#define TKUTIL_RELEASE_DATE "2010-02-01"
#define TKUTIL_RELEASE_DATE "2010-03-26"
#include "ruby.h"
@ -1159,11 +1159,11 @@ subst_free(ptr)
if (ptr) {
for(i = 0; i < CBSUBST_TBL_MAX; i++) {
if (ptr->key[i] != NULL) {
free(ptr->key[i]);
free(ptr->key[i]); /* allocated by malloc */
ptr->key[i] = NULL;
}
}
free(ptr);
xfree(ptr); /* allocated by ALLOC */
}
}
@ -1340,7 +1340,7 @@ cbsubst_sym_to_subst(self, sym)
ret = rb_str_new2(buf);
free(buf);
xfree(buf);
return ret;
}
@ -1408,7 +1408,7 @@ cbsubst_get_subst_arg(argc, argv, self)
ret = rb_str_new2(buf);
free(buf);
xfree(buf);
return ret;
}
@ -1462,7 +1462,7 @@ cbsubst_get_subst_key(self, str)
*ptr = '\0';
ret = rb_str_new2(buf);
free(buf);
xfree(buf);
return ret;
}
@ -1506,8 +1506,8 @@ cbsubst_get_all_subst_keys(self)
ret = rb_ary_new3(2, rb_str_new2(keys_buf), rb_str_new2(buf));
free(buf);
free(keys_buf);
xfree(buf);
xfree(keys_buf);
return ret;
}