summaryrefslogtreecommitdiff
path: root/ext/tk/tkutil/tkutil.c
AgeCommit message (Collapse)Author
2016-08-09* ext/tk: Tk is removed from stdlib. [Feature #8539]naruse
https://github.com/ruby/tk is the new upstream. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23remove unnecessary volatilesnobu
* ext/dbm/dbm.c (fdbm_initialize): used for rb_sys_fail_str. * ext/sdbm/init.c (fsdbm_initialize): ditto. * ext/tk/tcltklib.c (lib_do_one_event_core): no effect. * ext/tk/tkutil/tkutil.c (tk_eval_cmd, tk_get_eval_string): no effect if tail call optimized. * ext/tk/tkutil/tkutil.c (cbsubst_table_setup): set to const. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23tkutil.c: GC guardsnobu
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): add GC guards instead of volatile after the uses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-14tkutil.c: ary can be nilnobu
* ext/tk/tkutil/tkutil.c (tk_hash_kv): the third argument can be nil not only an Array. reported by @windwiny at https://github.com/ruby/ruby/commit/cdaa94e#commitcomment-17096618 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-07tkutil.c: fix overrunnobu
* ext/tk/tkutil/tkutil.c (cbsubst_initialize): fix out-of-bound access when no arguments given. `p Tk::Event.new` crashed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13tkutil.c: check argnobu
* ext/tk/tkutil/tkutil.c (tk_hash_kv): check types of array argument. reported by Marcin 'Icewall' Noga of Cisco Talos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13tkutil.c: array lengthnobu
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): check length of argument arrays for each access, as callback methods can modify them. reported by Marcin 'Icewall' Noga of Cisco Talos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13tkutil.c: check argsnobu
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): check types of argument elements. reported by Marcin 'Icewall' Noga of Cisco Talos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-05ext: use RARRAY_ASETnobu
* ext/socket/socket.c (make_addrinfo): use RARRAY_ASET for write-barrier. * ext/tk/tcltklib.c ({call,eval,invoke}_queue_handler): ditto. * ext/tk/tkutil/tkutil.c (ary2list, ary2list2): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-05tk: RARRAY_AREFnobu
* ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c (RARRAY_AREF): add fallback definition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-05ext: use RARRAY_AREFnobu
* ext/**/*.c: prefer RARRAY_AREF to indexing RARRAY_CONST_PTR. pointed out by hanmac. https://github.com/ruby/ruby/commit/3553a86#commitcomment-14187670 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04tkutil.c: rb_ary_catnobu
* ext/tk/tkutil/tkutil.c (rb_ary_cat): fallback definition. rb_ary_cat() is available since 2.0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04tkutil.c: strndupnobu
* ext/tk/tkutil/tkutil.c (strndup): fallback definition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04ext: use RARRAY_CONST_PTRnobu
* ext/bigdecimal/bigdecimal.c: use RARRAY_CONST_PTR just fore reference instead of RARRAY_PTR, to keep the array WB-protected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-27tkutil.c: use local variablesnobu
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): use local variables instead of repeating RARRAY_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-01tkutil.c: fix out-of-bounds accessnobu
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): check array length not access out-of-bounds. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-31tkutil.c: fix memory leak and segfaultnobu
* ext/tk/tkutil/tkutil.c (cbsubst_append_inf_key): extract a function append a key in subst info to a string. make result strings first and get rid of potential memory leak. * ext/tk/tkutil/tkutil.c (cbsubst_get_subst_arg): allocate the result buffer as a string to fix: * memory leak when the argument key is not found: loop {Tk::Event.subst_arg(:a) rescue nil} * buffer overflow segfault when many arguments: class T < TkUtil::CallbackSubst _setup_subst_table([[?a, ?A, :_a]], []) subst_arg(*[:_a]*1000).size end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-31tkutil.c: reduce unnecessary buffernobu
* ext/tk/tkutil/tkutil.c (cbsubst_get_subst_key): reduce unnecessary buffer. the result string is one byte per one word. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-28tcltklib.c: allocate structs with wrappernobu
* ext/tk/tcltklib.c (ip_create_slave_core): allocate structs with making new wrapper objects and get rid of potential memory leak. * ext/tk/tkutil/tkutil.c (allocate_cbsubst_info): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-28tkutil.c: check arguments typenobu
* ext/tk/tkutil/tkutil.c (cbsubst_get_subst_key): check arguments type. implicit conversion is disabled to get rid of method calls which can modify other arguments. * ext/tk/tkutil/tkutil.c (cbsubst_table_setup): ditto. * ext/tk/tkutil/tkutil.c (cbsubst_scan_args): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-28tkutil.c: check typenobu
* ext/tk/tkutil/tkutil.c (cbsubst_get_subst_key): ensure the result type of a method call to be an array before accessing by RARRAY macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-19ext: suppress warningsnobu
* ext/{etc,openssl,tk}: Adding parens and comparisons around assignments to get rid of Wparentheses warnings. [Fix GH-875] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-17tkutil.c: revert r48250nobu
* ext/tk/tkutil/tkutil.c (Init_tkutil): TkUtil::CallbackSubst and TkUtil::CallbackSubst::Info need the default allocator. [ruby-list:50115] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-14tkutil.c: fallback rb_id2strnobu
* ext/tk/tkutil/tkutil.c (rb_id2str): add fallback definition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-14tkutil.c: use rb_sym2strnobu
* ext/tk/tkutil/tkutil.c (rb_sym2str): use rb_sym2str always but not rb_sym_to_s, and fallback to rb_id2str and SYM2ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-16use rb_funcallvnobu
* use rb_funcallv() for no arguments call instead of variadic rb_funcall(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03tkutil.c: typed datanobu
* ext/tk/tkutil/tkutil.c (cbsubst_info_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-03ext/tk/tkutil/tkutil.c: disable untyped data warningsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-03tkutil.c: inherit Datanobu
* ext/tk/tkutil/tkutil.c: use Data as super class, not to inherit useless methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-30tkutil.c: remove useless branchesnobu
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): remove useless branches and get rid of out of bound access. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-30protoize no-arguments functionsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-03ext: get rid of inadvertent ID creationnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-03ext: prefer RB_TYPE_P over comparison TYPE with constantsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-17tkutil.c: prevent temporary objects from GCnobu
* ext/tk/tkutil/tkutil.c: use rb_sprintf(), rb_id2str(), and rb_intern_str() instead of rb_intern() and RSTRING_PTR() with RB_GC_GUARD(), to prevent temporary objects from GC. [ruby-core:39000] [Bug #5199] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27suppress warningsnobu
* ext/-test-/postponed_job/postponed_job.c (pjob_register), (pjob_call_direct): none void function. * ext/-test-/tracepoint/tracepoint.c (tracepoint_track_objspace_events): adjust type to get rid of implicit cast. * ext/objspace/object_tracing.c (newobj_i): ditto. * ext/tk/tkutil/tkutil.c (tk_conv_args): adjust type against RHASH_SIZE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-20tkutil.c: NIL_Pnobu
* ext/tk/tkutil/tkutil.c (tk_symbolkey2str, ary2list, ary2list2): do not assume NIL_P() to be parenthesized always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13* encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "controldrbrain
reaches end of non-void function" warnings. [ruby-trunk - Bug #6066] * re.c (name_to_backref_number): ditto. * object.c (rb_Float): ditto. * io.c (io_readpartial): ditto. * io.c (io_read_nonblock): ditto. * pack.c (rb_uv_to_utf8): ditto. * proc.c (rb_method_entry_arity): ditto. * vm_method.c (rb_f_notimplement): ditto. * struct.c (rb_struct_aset_id): ditto. * class.c (rb_scan_args): ditto. * process.c (rlimit_resource_type): ditto. * process.c (rlimit_resource_value): ditto. * process.c (p_uid_switch): ditto. * process.c (p_gid_switch): ditto. * ext/digest/digest.c (rb_digest_instance_update): ditto. * ext/digest/digest.c (rb_digest_instance_finish): ditto. * ext/digest/digest.c (rb_digest_instance_reset): ditto. * ext/digest/digest.c (rb_digest_instance_block_length): ditto. * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto. * ext/dl/handle.c (rb_dlhandle_close): ditto. * ext/tk/tcltklib.c (pending_exception_check0): ditto. * ext/tk/tcltklib.c (pending_exception_check1): ditto. * ext/tk/tcltklib.c (ip_cancel_eval_core): ditto. * ext/tk/tcltklib.c (lib_get_reltype_name): ditto. * ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto. * ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto. * ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto. * ext/fiddle/conversions.c (generic_to_value): ditto. * ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto. * ext/socket/socket.c (sock_s_getnameinfo): ditto. * ext/ripper/eventids2.c (ripper_token2eventid): ditto. * cont.c (return_fiber): ditto. * dmydln.c (dln_load): ditto. * vm_insnhelper.c (vm_search_normal_superclass): ditto. * bignum.c (big_fdiv): ditto. * marshal.c (r_symlink): ditto. * marshal.c (r_symbol): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-10* st.c: add st_foreach_check for fixing iteration over packed tablenobu
and st_delete_safe. patched by Sokolov Yura at https://github.com/ruby/ruby/pull/84 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-20* ext/tk/tkutil/tkutil.c (cbsubst_info): fix shorten-64-to-32 warnings.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-20* ext/tk/tkutil/tkutil.c: fix shorten-64-to-32 warnings.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-22* ext/**/*.[ch]: removed trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-25* ext/tk/extconf.rb: fix [ruby-core:28901] [Bug #2997]. Thanks, Michael Graff.nagai
* 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
2010-03-13* ext/tk/extconf.rb: fix [Bug #2840] Tk doesn't built in mingw.nagai
* ext/tk/lib/tk.rb: forgot updating RELEASE_DATE at last commit. * ext/tk/tkutil/tkutil.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-31* ext/tk/tkutil/tkutil.c: fix SEGV on TkUtil::CallbackSubst._setup_subst_table.nagai
* ext/tk/lib/tk.rb: [ruby1.9] fix freeze at exit. * ext/tk/lib/tk.rb: [POTENTIAL INCOMPATIBLE] return NoMethodError for TkWindow#to_ary and to_str. * ext/tk/lib/tkextlib/tcllib/plotchart.rb: wrong arguments. * ext/tk/sampel/tkballoonhelp.rb: fail to support TkEntry widgets. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-26* ext/tk/tcltklib.c,stubs.c: remove errors or warnings when compilednagai
with old ruby 1.8.x. * ext/tk/tkutil/tkutil.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12* ext/tk/extconf.rb: New strategy for searching Tcl/Tk libraries.nagai
* ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes. ( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. ) * ext/tk/*: Unify sources between Ruby 1.8 & 1.9. Improve default_widget_set handling. * ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9. ( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk callbacks may freeze. On Ruby 1.9, cannot create a second master interpreter (creating slaves are OK); supported master interpreter is the default master interpreter only. ) * ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions. Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 BWidgets 1.7 ==> BWidgets 1.8 TkTable 2.9 ==> TkTable 2.10 TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 TclX 2005-02-07 ==> TclX 2008-12-15 Trofs 0.4.3 ==> Trofs 0.4.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-04* thread.c (rb_thread_check_trap_pending): added for compatibility.ko1
* ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: remove ruby/signal.h dependency. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-23* ext/tk/{stubs,tcltklib}.c, ext/tk/tkutil/tkutil.c: fix warningsnobu
about constness and signedness. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-15* ext/tk/{,tkutil/}extconf.rb: ruby/ruby.h no longer needs to benobu
checked. * ext/tk/{tcltklib.c,tkutil/tkutil.c}: check macros for each headers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-15* ext/tk/extconf.rb, ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: Doknu
not test ruby/ruby.h, which makes OS X's gcc pick the wrong header file from Ruby.framework. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e