summaryrefslogtreecommitdiffhomepage
path: root/src/symbol.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-08-19 10:38:30 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 16:21:50 +0900
commitcaee1f68a200d9df1831c4cf0e1954482c317474 (patch)
treee2417d71bdda57a90497bc3a25dd7dcfaeffc11f /src/symbol.c
parenta4302524d06c2b63617285286dcf41b5a45baf75 (diff)
downloadmruby-caee1f68a200d9df1831c4cf0e1954482c317474.tar.gz
mruby-caee1f68a200d9df1831c4cf0e1954482c317474.zip
Change the return type of `mrb_check_intern()` and friends.
They used to return `mrb_value` but now return `mrb_sym` for consistency with other `intern` functions. If symbols are not defined, `check` functions return `0`, instead of `nil` in the past. It causes API incompatibility but I believe few people use those functions out of the core, and those changes are very easy to handle, hopefully.
Diffstat (limited to 'src/symbol.c')
-rw-r--r--src/symbol.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/symbol.c b/src/symbol.c
index ed2fe7cee..704e1d9e0 100644
--- a/src/symbol.c
+++ b/src/symbol.c
@@ -289,24 +289,24 @@ mrb_intern_str(mrb_state *mrb, mrb_value str)
return mrb_intern(mrb, RSTRING_PTR(str), RSTRING_LEN(str));
}
-MRB_API mrb_value
+MRB_API mrb_sym
mrb_check_intern(mrb_state *mrb, const char *name, size_t len)
{
mrb_sym sym;
sym_validate_len(mrb, len);
sym = find_symbol(mrb, name, len, NULL);
- if (sym > 0) return mrb_symbol_value(sym);
- return mrb_nil_value();
+ if (sym > 0) return sym;
+ return 0;
}
-MRB_API mrb_value
+MRB_API mrb_sym
mrb_check_intern_cstr(mrb_state *mrb, const char *name)
{
return mrb_check_intern(mrb, name, strlen(name));
}
-MRB_API mrb_value
+MRB_API mrb_sym
mrb_check_intern_str(mrb_state *mrb, mrb_value str)
{
return mrb_check_intern(mrb, RSTRING_PTR(str), RSTRING_LEN(str));