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

ruby-changes:35121

From: suke <ko1@a...>
Date: Sat, 16 Aug 2014 19:34:38 +0900 (JST)
Subject: [ruby-changes:35121] suke:r47203 (trunk): * ext/win32ole/win32ole_event.c (evs_length): use RARRAY_LEN instead

suke	2014-08-16 19:34:24 +0900 (Sat, 16 Aug 2014)

  New Revision: 47203

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

  Log:
    * ext/win32ole/win32ole_event.c (evs_length): use RARRAY_LEN instead
      of calling Array#length method.

  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/win32ole_event.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47202)
+++ ChangeLog	(revision 47203)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Aug 16 19:32:06 2014  Masaki Suketa <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole_event.c (evs_length): use RARRAY_LEN instead
+	  of calling Array#length method.
+
 Sat Aug 16 10:20:17 2014  Eric Wong  <e@8...>
 
 	* time.c (time_timespec): fix tv_nsec overflow
Index: ext/win32ole/win32ole_event.c
===================================================================
--- ext/win32ole/win32ole_event.c	(revision 47202)
+++ ext/win32ole/win32ole_event.c	(revision 47203)
@@ -51,7 +51,7 @@ typedef struct tagIEVENTSINKOBJ { https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L51
     IEventSinkVtbl *lpVtbl;
     DWORD m_cRef;
     IID m_iid;
-    int m_event_id;
+    long  m_event_id;
     ITypeInfo *pTypeInfo;
 }IEVENTSINKOBJ, *PIEVENTSINKOBJ;
 
@@ -102,7 +102,7 @@ static VALUE fev_get_handler(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L102
 static VALUE evs_push(VALUE ev);
 static VALUE evs_delete(long i);
 static VALUE evs_entry(long i);
-static VALUE evs_length(void);
+static long  evs_length(void);
 
 STDMETHODIMP EVENTSINK_Invoke(
     PEVENTSINK pEventSink,
@@ -942,8 +942,7 @@ ev_advise(int argc, VALUE *argv, VALUE s https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L942
     }
 
     Data_Get_Struct(self, struct oleeventdata, poleev);
-    pIEV->m_event_id
-        = NUM2INT(evs_length());
+    pIEV->m_event_id = evs_length();
     pIEV->pTypeInfo = pTypeInfo;
     poleev->dwCookie = dwCookie;
     poleev->pConnectionPoint = pConnectionPoint;
@@ -1171,10 +1170,10 @@ evs_entry(long i) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L1170
     return rb_ary_entry(ary_ole_event, i);
 }
 
-static VALUE
+static long
 evs_length(void)
 {
-    return rb_funcall(ary_ole_event, rb_intern("length"), 0);
+    return RARRAY_LEN(ary_ole_event);
 }
 
 /*

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

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