summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-25 08:13:18 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-25 08:13:18 +0000
commit2703953ca6763176932dee45674f59f76db22262 (patch)
tree018bc3e1bfdb4dd95d5dcdecca7c4bfe0c0a14ba /include/ruby
parent4ef48a781ad8519f8dfe4871336d25a84e62bcd2 (diff)
merge revision(s) 49096,51353,53168,53169: [Backport #11834]
test_m17n.rb: split test_scrub * test/ruby/test_m17n.rb (TestM17N#test_scrub): split into some tests. * include/ruby/ruby.h: add raw FL macros, which assume always the argument object is not a special constant. * internal.h (STR_EMBED_P, STR_SHARED_P): valid only for T_STRING. * string.c: deal with taint flags directly across String instances. * transcode.c (rb_econv_substr_append, econv_primitive_convert): the result should be infected by the original string. * string.c (rb_str_scrub): the result should be infected by the original string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@54260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r--include/ruby/ruby.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 95965d6b6a..0bf3567c29 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1167,19 +1167,27 @@ struct RBignum {
#define FL_ABLE(x) (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) != T_NODE)
#define FL_TEST_RAW(x,f) (RBASIC(x)->flags&(f))
#define FL_TEST(x,f) (FL_ABLE(x)?FL_TEST_RAW((x),(f)):0)
+#define FL_ANY_RAW(x,f) FL_TEST_RAW((x),(f))
#define FL_ANY(x,f) FL_TEST((x),(f))
+#define FL_ALL_RAW(x,f) (FL_TEST_RAW((x),(f)) == (f))
#define FL_ALL(x,f) (FL_TEST((x),(f)) == (f))
-#define FL_SET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags |= (f);} while (0)
-#define FL_UNSET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags &= ~(f);} while (0)
-#define FL_REVERSE(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags ^= (f);} while (0)
-
+#define FL_SET_RAW(x,f) (RBASIC(x)->flags |= (f))
+#define FL_SET(x,f) (FL_ABLE(x) ? FL_SET_RAW(x, f) : 0)
+#define FL_UNSET_RAW(x,f) (RBASIC(x)->flags &= ~(f))
+#define FL_UNSET(x,f) (FL_ABLE(x) ? FL_UNSET_RAW(x, f) : 0)
+#define FL_REVERSE_RAW(x,f) (RBASIC(x)->flags ^= (f))
+#define FL_REVERSE(x,f) (FL_ABLE(x) ? FL_REVERSE_RAW(x, f) : 0)
+
+#define OBJ_TAINTED_RAW(x) FL_TEST_RAW(x, FL_TAINT)
#define OBJ_TAINTED(x) (!!FL_TEST((x), FL_TAINT))
+#define OBJ_TAINT_RAW(x) FL_SET_RAW(x, FL_TAINT)
#define OBJ_TAINT(x) FL_SET((x), FL_TAINT)
#define OBJ_UNTRUSTED(x) OBJ_TAINTED(x)
#define OBJ_UNTRUST(x) OBJ_TAINT(x)
+#define OBJ_INFECT_RAW(x,s) FL_SET_RAW(x, OBJ_TAINTED_RAW(s))
#define OBJ_INFECT(x,s) do { \
if (FL_ABLE(x) && FL_ABLE(s)) \
- RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT; \
+ FL_SET_RAW(x, OBJ_TAINTED_RAW(s)); \
} while (0)
#define OBJ_FROZEN(x) (!!(FL_ABLE(x)?(RBASIC(x)->flags&(FL_FREEZE)):(FIXNUM_P(x)||FLONUM_P(x)||SYMBOL_P(x))))