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

ruby-changes:29090

From: akr <ko1@a...>
Date: Fri, 7 Jun 2013 19:03:24 +0900 (JST)
Subject: [ruby-changes:29090] akr:r41142 (trunk): * internal.h (numberof): Gathered from various files.

akr	2013-06-07 19:01:19 +0900 (Fri, 07 Jun 2013)

  New Revision: 41142

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

  Log:
    * internal.h (numberof): Gathered from various files.
    
    * array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
      load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
      error.c, ruby.c: Remove the definitions of numberof.

  Modified files:
    trunk/ChangeLog
    trunk/array.c
    trunk/compile.c
    trunk/enum.c
    trunk/error.c
    trunk/eval.c
    trunk/gc.c
    trunk/internal.h
    trunk/io.c
    trunk/iseq.c
    trunk/load.c
    trunk/math.c
    trunk/parse.y
    trunk/process.c
    trunk/ruby.c
    trunk/string.c
    trunk/struct.c
    trunk/thread_pthread.c

Index: array.c
===================================================================
--- array.c	(revision 41141)
+++ array.c	(revision 41142)
@@ -24,8 +24,6 @@ https://github.com/ruby/ruby/blob/trunk/array.c#L24
 #endif
 #include <assert.h>
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 VALUE rb_cArray;
 
 static ID id_cmp, id_div, id_power;
Index: math.c
===================================================================
--- math.c	(revision 41141)
+++ math.c	(revision 41142)
@@ -19,8 +19,6 @@ https://github.com/ruby/ruby/blob/trunk/math.c#L19
     extern int signbit(double);
 #endif
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 VALUE rb_mMath;
 VALUE rb_eMathDomainError;
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41141)
+++ ChangeLog	(revision 41142)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun  7 18:58:56 2013  Tanaka Akira  <akr@f...>
+
+	* internal.h (numberof): Gathered from various files.
+
+	* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
+	  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
+	  error.c, ruby.c: Remove the definitions of numberof.
+
 Fri Jun  7 18:24:39 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (rb_absint_size): Declare a variable, i, just before used
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 41141)
+++ thread_pthread.c	(revision 41142)
@@ -64,10 +64,6 @@ static pthread_t timer_thread_id; https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L64
 # define USE_SLEEPY_TIMER_THREAD 0
 #endif
 
-#ifndef numberof
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-#endif
-
 static void
 gvl_acquire_common(rb_vm_t *vm)
 {
Index: iseq.c
===================================================================
--- iseq.c	(revision 41141)
+++ iseq.c	(revision 41142)
@@ -18,8 +18,6 @@ https://github.com/ruby/ruby/blob/trunk/iseq.c#L18
 #include "vm_core.h"
 #include "iseq.h"
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 #include "insns.inc"
 #include "insns_info.inc"
 
Index: enum.c
===================================================================
--- enum.c	(revision 41141)
+++ enum.c	(revision 41142)
@@ -17,8 +17,6 @@ https://github.com/ruby/ruby/blob/trunk/enum.c#L17
 
 #define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
 
 VALUE rb_mEnumerable;
Index: string.c
===================================================================
--- string.c	(revision 41141)
+++ string.c	(revision 41142)
@@ -31,8 +31,6 @@ https://github.com/ruby/ruby/blob/trunk/string.c#L31
 
 #define STRING_ENUMERATORS_WANTARRAY 0 /* next major */
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 #undef rb_str_new_cstr
 #undef rb_tainted_str_new_cstr
 #undef rb_usascii_str_new_cstr
Index: io.c
===================================================================
--- io.c	(revision 41141)
+++ io.c	(revision 41142)
@@ -119,8 +119,6 @@ https://github.com/ruby/ruby/blob/trunk/io.c#L119
 off_t __syscall(quad_t number, ...);
 #endif
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 #define IO_RBUF_CAPA_MIN  8192
 #define IO_CBUF_CAPA_MIN  (128*1024)
 #define IO_RBUF_CAPA_FOR(fptr) (NEED_READCONV(fptr) ? IO_CBUF_CAPA_MIN : IO_RBUF_CAPA_MIN)
Index: load.c
===================================================================
--- load.c	(revision 41141)
+++ load.c	(revision 41142)
@@ -11,8 +11,6 @@ https://github.com/ruby/ruby/blob/trunk/load.c#L11
 
 VALUE ruby_dln_librefs;
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 #define IS_RBEXT(e) (strcmp((e), ".rb") == 0)
 #define IS_SOEXT(e) (strcmp((e), ".so") == 0 || strcmp((e), ".o") == 0)
 #ifdef DLEXT2
Index: compile.c
===================================================================
--- compile.c	(revision 41141)
+++ compile.c	(revision 41142)
@@ -19,7 +19,6 @@ https://github.com/ruby/ruby/blob/trunk/compile.c#L19
 #include "insns.inc"
 #include "insns_info.inc"
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
 #define FIXNUM_INC(n, i) ((n)+(INT2FIX(i)&~FIXNUM_FLAG))
 #define FIXNUM_OR(n, i) ((n)|INT2FIX(i))
 
Index: struct.c
===================================================================
--- struct.c	(revision 41141)
+++ struct.c	(revision 41142)
@@ -125,7 +125,6 @@ static VALUE rb_struct_ref7(VALUE obj) { https://github.com/ruby/ruby/blob/trunk/struct.c#L125
 static VALUE rb_struct_ref8(VALUE obj) {return RSTRUCT_PTR(obj)[8];}
 static VALUE rb_struct_ref9(VALUE obj) {return RSTRUCT_PTR(obj)[9];}
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
 #define N_REF_FUNC numberof(ref_func)
 
 static VALUE (*const ref_func[])(VALUE) = {
Index: eval.c
===================================================================
--- eval.c	(revision 41141)
+++ eval.c	(revision 41142)
@@ -20,8 +20,6 @@ https://github.com/ruby/ruby/blob/trunk/eval.c#L20
 #include "vm_core.h"
 #include "probes_helper.h"
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 NORETURN(void rb_raise_jump(VALUE));
 
 NODE *rb_vm_get_cref(const rb_iseq_t *, const VALUE *);
Index: gc.c
===================================================================
--- gc.c	(revision 41141)
+++ gc.c	(revision 41142)
@@ -2825,8 +2825,6 @@ mark_const_tbl(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L2825
      ((start) = STACK_END, (end) = STACK_START) : ((start) = STACK_START, (end) = STACK_END+(appendix)))
 #endif
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 static void
 mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
 {
Index: parse.y
===================================================================
--- parse.y	(revision 41141)
+++ parse.y	(revision 41142)
@@ -31,8 +31,6 @@ https://github.com/ruby/ruby/blob/trunk/parse.y#L31
 #include <ctype.h>
 #include "probes.h"
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 #define YYMALLOC(size)		rb_parser_malloc(parser, (size))
 #define YYREALLOC(ptr, size)	rb_parser_realloc(parser, (ptr), (size))
 #define YYCALLOC(nelem, size)	rb_parser_calloc(parser, (nelem), (size))
Index: process.c
===================================================================
--- process.c	(revision 41141)
+++ process.c	(revision 41142)
@@ -80,8 +80,6 @@ https://github.com/ruby/ruby/blob/trunk/process.c#L80
 #include <grp.h>
 #endif
 
-#define numberof(array) (int)(sizeof(array)/sizeof((array)[0]))
-
 #if defined(HAVE_TIMES) || defined(_WIN32)
 static VALUE rb_cProcessTms;
 #endif
Index: error.c
===================================================================
--- error.c	(revision 41141)
+++ error.c	(revision 41142)
@@ -25,8 +25,6 @@ https://github.com/ruby/ruby/blob/trunk/error.c#L25
 #include <unistd.h>
 #endif
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 #ifndef EXIT_SUCCESS
 #define EXIT_SUCCESS 0
 #endif
Index: internal.h
===================================================================
--- internal.h	(revision 41141)
+++ internal.h	(revision 41142)
@@ -19,6 +19,8 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/internal.h#L19
 #endif
 #endif
 
+#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
+
 #define GCC_VERSION_SINCE(major, minor, patchlevel) \
   (defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
    ((__GNUC__ > (major)) ||  \
Index: ruby.c
===================================================================
--- ruby.c	(revision 41141)
+++ ruby.c	(revision 41142)
@@ -52,8 +52,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby.c#L52
 char *getenv();
 #endif
 
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
 #if defined DISABLE_RUBYGEMS && DISABLE_RUBYGEMS
 #define DEFAULT_RUBYGEMS_ENABLED "disabled"
 #else

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

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