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

ruby-changes:41939

From: nobu <ko1@a...>
Date: Mon, 7 Mar 2016 10:58:16 +0900 (JST)
Subject: [ruby-changes:41939] nobu:r54013 (trunk): win32ole_event.c: use rb_write_error_str

nobu	2016-03-07 10:58:09 +0900 (Mon, 07 Mar 2016)

  New Revision: 54013

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54013

  Log:
    win32ole_event.c: use rb_write_error_str
    
    * ext/win32ole/win32ole_event.c (rescue_callback): use
      rb_write_error_str instead of rb_write_error, to respect
      the encoding and prevent the message from GC.
    * internal.h (rb_write_error_str): export.

  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/win32ole_event.c
    trunk/internal.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54012)
+++ ChangeLog	(revision 54013)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar  7 10:58:07 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/win32ole/win32ole_event.c (rescue_callback): use
+	  rb_write_error_str instead of rb_write_error, to respect
+	  the encoding and prevent the message from GC.
+
+	* internal.h (rb_write_error_str): export.
+
 Mon Mar  7 01:38:41 2016  Rei Odaira  <Rei.Odaira@g...>
 
 	* test/ruby/test_process.rb (test_execopts_gid): Skip a test
Index: ext/win32ole/win32ole_event.c
===================================================================
--- ext/win32ole/win32ole_event.c	(revision 54012)
+++ ext/win32ole/win32ole_event.c	(revision 54013)
@@ -6,6 +6,8 @@ https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L6
  *   <code>WIN32OLE_EVENT</code> objects controls OLE event.
  */
 
+RUBY_EXTERN void rb_write_error_str(VALUE mesg);
+
 typedef struct {
     struct IEventSinkVtbl * lpVtbl;
 } IEventSink, *PEVENTSINK;
@@ -468,7 +470,7 @@ rescue_callback(VALUE arg) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L470
     VALUE msg = rb_funcall(e, rb_intern("message"), 0);
     bt = rb_ary_entry(bt, 0);
     error = rb_sprintf("%"PRIsVALUE": %"PRIsVALUE" (%s)\n", bt, msg, rb_obj_classname(e));
-    rb_write_error(StringValuePtr(error));
+    rb_write_error_str(error);
     rb_backtrace();
     ruby_finalize();
     exit(-1);
Index: internal.h
===================================================================
--- internal.h	(revision 54012)
+++ internal.h	(revision 54013)
@@ -872,7 +872,6 @@ const char *ruby_get_inplace_mode(void); https://github.com/ruby/ruby/blob/trunk/internal.h#L872
 void ruby_set_inplace_mode(const char *);
 ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
 void rb_stdio_set_default_encoding(void);
-void rb_write_error_str(VALUE mesg);
 VALUE rb_io_flush_raw(VALUE, int);
 size_t rb_io_memsize(const rb_io_t *);
 
@@ -1353,6 +1352,7 @@ VALUE rb_ident_hash_new(void); https://github.com/ruby/ruby/blob/trunk/internal.h#L1352
 /* io.c (export) */
 void rb_maygvl_fd_fix_cloexec(int fd);
 int rb_gc_for_fd(int err);
+void rb_write_error_str(VALUE mesg);
 
 /* numeric.c (export) */
 VALUE rb_int_positive_pow(long x, unsigned long y);

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

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