I think this could even shorter: return mrb_bool_value(h && (kh_size(h) == 0));