diff options
author | S.H <gamelinks007@gmail.com> | 2021-09-15 08:11:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 08:11:05 +0900 |
commit | b8c3a84bddac7366c4e391234b2535253869e885 (patch) | |
tree | 872dfa2014b75fc4c5dadb060900afa118cded71 /file.c | |
parent | 89242279e61b023a81c58065c62a82de8829d0b3 (diff) |
Refactor and Using RBOOL macro
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4837
Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -2019,8 +2019,7 @@ rb_file_file_p(VALUE obj, VALUE fname) struct stat st; if (rb_stat(fname, &st) < 0) return Qfalse; - if (S_ISREG(st.st_mode)) return Qtrue; - return Qfalse; + return RBOOL(S_ISREG(st.st_mode)); } /* @@ -2039,8 +2038,7 @@ rb_file_zero_p(VALUE obj, VALUE fname) struct stat st; if (rb_stat(fname, &st) < 0) return Qfalse; - if (st.st_size == 0) return Qtrue; - return Qfalse; + return RBOOL(st.st_size == 0); } /* @@ -2080,8 +2078,7 @@ rb_file_owned_p(VALUE obj, VALUE fname) struct stat st; if (rb_stat(fname, &st) < 0) return Qfalse; - if (st.st_uid == geteuid()) return Qtrue; - return Qfalse; + return RBOOL(st.st_uid == geteuid()); } static VALUE @@ -2090,8 +2087,7 @@ rb_file_rowned_p(VALUE obj, VALUE fname) struct stat st; if (rb_stat(fname, &st) < 0) return Qfalse; - if (st.st_uid == getuid()) return Qtrue; - return Qfalse; + return RBOOL(st.st_uid == getuid()); } /* @@ -2124,8 +2120,7 @@ check3rdbyte(VALUE fname, int mode) struct stat st; if (rb_stat(fname, &st) < 0) return Qfalse; - if (st.st_mode & mode) return Qtrue; - return Qfalse; + return RBOOL(st.st_mode & mode); } #endif |