From 8890a992a665f59ee9ae8b9e877693e3fdae241a Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 29 Apr 2013 09:23:43 +0900 Subject: always use unsigned int as mrb_bool even in C++ --- include/mrbconf.h | 10 ---------- include/mruby/value.h | 2 ++ src/string.c | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/include/mrbconf.h b/include/mrbconf.h index 1e4a39381..72bae93f6 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -132,18 +132,8 @@ typedef short mrb_sym; # define PRIo64 "I64o" # define PRIx64 "I64x" # define PRIX64 "I64X" -# ifdef __cplusplus -typedef bool mrb_bool; -# else -typedef unsigned int mrb_bool; -# endif #else # include -# ifdef __cplusplus -typedef bool mrb_bool; -# else -typedef _Bool mrb_bool; -# endif #endif #ifdef ENABLE_STDIO diff --git a/include/mruby/value.h b/include/mruby/value.h index 1cc5263ad..082438d56 100644 --- a/include/mruby/value.h +++ b/include/mruby/value.h @@ -7,6 +7,8 @@ #ifndef MRUBY_VALUE_H #define MRUBY_VALUE_H +typedef unsigned int mrb_bool; + #ifndef MRB_NAN_BOXING enum mrb_vtype { diff --git a/src/string.c b/src/string.c index 7e66b8369..9bc178499 100644 --- a/src/string.c +++ b/src/string.c @@ -1286,7 +1286,7 @@ mrb_str_include(mrb_state *mrb, mrb_value self) mrb_get_args(mrb, "o", &str2); if (mrb_type(str2) == MRB_TT_FIXNUM) { - include_p = memchr(RSTRING_PTR(self), mrb_fixnum(str2), RSTRING_LEN(self)); + include_p = (memchr(RSTRING_PTR(self), mrb_fixnum(str2), RSTRING_LEN(self)) != NULL); } else { str2 = mrb_str_to_str(mrb, str2); -- cgit v1.2.3