diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-07 10:01:19 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-07 10:01:19 +0000 |
commit | bd15d4ca78dd8a9c60e0edf8814fb8e971d35097 (patch) | |
tree | d170cde9a94bb36ba5baf58fb562278f74ce5ae1 | |
parent | 8e65ff7e312b1d18f7aec9d8bac066ef13cb6705 (diff) | |
download | ruby-bd15d4ca78dd8a9c60e0edf8814fb8e971d35097.tar.gz |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | array.c | 2 | ||||
-rw-r--r-- | compile.c | 1 | ||||
-rw-r--r-- | enum.c | 2 | ||||
-rw-r--r-- | error.c | 2 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | gc.c | 2 | ||||
-rw-r--r-- | internal.h | 2 | ||||
-rw-r--r-- | io.c | 2 | ||||
-rw-r--r-- | iseq.c | 2 | ||||
-rw-r--r-- | load.c | 2 | ||||
-rw-r--r-- | math.c | 2 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | process.c | 2 | ||||
-rw-r--r-- | ruby.c | 2 | ||||
-rw-r--r-- | string.c | 2 | ||||
-rw-r--r-- | struct.c | 1 | ||||
-rw-r--r-- | thread_pthread.c | 4 |
18 files changed, 10 insertions, 32 deletions
@@ -1,3 +1,11 @@ +Fri Jun 7 18:58:56 2013 Tanaka Akira <akr@fsij.org> + + * 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@fsij.org> * bignum.c (rb_absint_size): Declare a variable, i, just before used @@ -24,8 +24,6 @@ #endif #include <assert.h> -#define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) - VALUE rb_cArray; static ID id_cmp, id_div, id_power; @@ -19,7 +19,6 @@ #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)) @@ -17,8 +17,6 @@ #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; @@ -25,8 +25,6 @@ #include <unistd.h> #endif -#define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) - #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif @@ -20,8 +20,6 @@ #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 *); @@ -2825,8 +2825,6 @@ mark_const_tbl(rb_objspace_t *objspace, st_table *tbl) ((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) { diff --git a/internal.h b/internal.h index 088eab2e68..c35b6b2916 100644 --- a/internal.h +++ b/internal.h @@ -19,6 +19,8 @@ extern "C" { #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)) || \ @@ -119,8 +119,6 @@ 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) @@ -18,8 +18,6 @@ #include "vm_core.h" #include "iseq.h" -#define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) - #include "insns.inc" #include "insns_info.inc" @@ -11,8 +11,6 @@ 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 @@ -19,8 +19,6 @@ extern int signbit(double); #endif -#define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) - VALUE rb_mMath; VALUE rb_eMathDomainError; @@ -31,8 +31,6 @@ #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)) @@ -80,8 +80,6 @@ #include <grp.h> #endif -#define numberof(array) (int)(sizeof(array)/sizeof((array)[0])) - #if defined(HAVE_TIMES) || defined(_WIN32) static VALUE rb_cProcessTms; #endif @@ -52,8 +52,6 @@ char *getenv(); #endif -#define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) - #if defined DISABLE_RUBYGEMS && DISABLE_RUBYGEMS #define DEFAULT_RUBYGEMS_ENABLED "disabled" #else @@ -31,8 +31,6 @@ #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 @@ -125,7 +125,6 @@ static VALUE rb_struct_ref7(VALUE obj) {return RSTRUCT_PTR(obj)[7];} 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) = { diff --git a/thread_pthread.c b/thread_pthread.c index eb98024d2b..f995757929 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -64,10 +64,6 @@ static pthread_t timer_thread_id; # 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) { |