summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-04-29 09:23:43 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2013-04-29 09:23:43 +0900
commit8890a992a665f59ee9ae8b9e877693e3fdae241a (patch)
tree3a6d89abbca8ef4ec4a0d266af8394857eedec15
parent22469f3be18d31605c01f9d38ed50246fefe51a2 (diff)
downloadmruby-8890a992a665f59ee9ae8b9e877693e3fdae241a.tar.gz
mruby-8890a992a665f59ee9ae8b9e877693e3fdae241a.zip
always use unsigned int as mrb_bool even in C++
-rw-r--r--include/mrbconf.h10
-rw-r--r--include/mruby/value.h2
-rw-r--r--src/string.c2
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 <inttypes.h>
-# 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);