summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-06-29 01:03:34 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-06-29 01:03:34 -0700
commitc963855a5a9d6545a5f0e3843ebc4d6563c9f5cb (patch)
tree37354f3cfaccaa403181623bf5ecd6fc9c79f8f9 /src
parent18121fba3732e8cc05a1d3c3d6c34e5d5bcf8dc2 (diff)
parent0e5ecae325c63e78868fe461b40c12f69f8eb74e (diff)
downloadmruby-c963855a5a9d6545a5f0e3843ebc4d6563c9f5cb.tar.gz
mruby-c963855a5a9d6545a5f0e3843ebc4d6563c9f5cb.zip
Merge pull request #1314 from suzukaze/refactor-hash-c
Refactor mrb_hash_empty_p() func in hash.c
Diffstat (limited to 'src')
-rw-r--r--src/hash.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/hash.c b/src/hash.c
index e08de0cfe..3684b3b40 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -776,16 +776,9 @@ mrb_value
mrb_hash_empty_p(mrb_state *mrb, mrb_value self)
{
khash_t(ht) *h = RHASH_TBL(self);
- mrb_bool empty_p;
- if (h) {
- empty_p = (kh_size(h) == 0);
- }
- else {
- empty_p = 1;
- }
-
- return mrb_bool_value(empty_p);
+ if (h) return mrb_bool_value(kh_size(h) == 0);
+ return mrb_true_value();
}
static mrb_value