summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-07 10:01:19 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-07 10:01:19 +0000
commitbd15d4ca78dd8a9c60e0edf8814fb8e971d35097 (patch)
treed170cde9a94bb36ba5baf58fb562278f74ce5ae1
parent8e65ff7e312b1d18f7aec9d8bac066ef13cb6705 (diff)
downloadruby-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--ChangeLog8
-rw-r--r--array.c2
-rw-r--r--compile.c1
-rw-r--r--enum.c2
-rw-r--r--error.c2
-rw-r--r--eval.c2
-rw-r--r--gc.c2
-rw-r--r--internal.h2
-rw-r--r--io.c2
-rw-r--r--iseq.c2
-rw-r--r--load.c2
-rw-r--r--math.c2
-rw-r--r--parse.y2
-rw-r--r--process.c2
-rw-r--r--ruby.c2
-rw-r--r--string.c2
-rw-r--r--struct.c1
-rw-r--r--thread_pthread.c4
18 files changed, 10 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 903e79727f..3b0960105a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/array.c b/array.c
index ae1f8c1fff..345a60bfc6 100644
--- a/array.c
+++ b/array.c
@@ -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;
diff --git a/compile.c b/compile.c
index e0ca056cd1..0bbb770885 100644
--- a/compile.c
+++ b/compile.c
@@ -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))
diff --git a/enum.c b/enum.c
index 1a30897ee6..2b9340fae7 100644
--- a/enum.c
+++ b/enum.c
@@ -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;
diff --git a/error.c b/error.c
index dac78218e7..b886a57667 100644
--- a/error.c
+++ b/error.c
@@ -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
diff --git a/eval.c b/eval.c
index 220ac1f8f0..87c96f0209 100644
--- a/eval.c
+++ b/eval.c
@@ -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 *);
diff --git a/gc.c b/gc.c
index eb37abd82b..aaaff2bf55 100644
--- a/gc.c
+++ b/gc.c
@@ -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)) || \
diff --git a/io.c b/io.c
index e850d1b470..aef0e4609d 100644
--- a/io.c
+++ b/io.c
@@ -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)
diff --git a/iseq.c b/iseq.c
index 586fd91f1c..a7d7d6d09f 100644
--- a/iseq.c
+++ b/iseq.c
@@ -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"
diff --git a/load.c b/load.c
index 5bd735a71b..6964df5f49 100644
--- a/load.c
+++ b/load.c
@@ -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
diff --git a/math.c b/math.c
index d0a179159c..5bd6c29865 100644
--- a/math.c
+++ b/math.c
@@ -19,8 +19,6 @@
extern int signbit(double);
#endif
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
VALUE rb_mMath;
VALUE rb_eMathDomainError;
diff --git a/parse.y b/parse.y
index 15c3d55d9d..9ee813d3a0 100644
--- a/parse.y
+++ b/parse.y
@@ -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))
diff --git a/process.c b/process.c
index 96cc6d2d94..d6602894c1 100644
--- a/process.c
+++ b/process.c
@@ -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
diff --git a/ruby.c b/ruby.c
index 8c8c4a1a66..8b4688254d 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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
diff --git a/string.c b/string.c
index 4111e963c7..5c0ff89014 100644
--- a/string.c
+++ b/string.c
@@ -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
diff --git a/struct.c b/struct.c
index d938c0ed55..9365ffe90d 100644
--- a/struct.c
+++ b/struct.c
@@ -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)
{