diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-12-04 13:06:15 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-12-26 20:45:12 +0900 |
commit | 797c46917e6a2f9faacba369b09132ddd3cc61cd (patch) | |
tree | ea173c7327d722dd15212c638b556f07e1cad7eb /internal | |
parent | 719efe72b0707ed9b0e75a2bbf00e41ecc9ab451 (diff) | |
download | ruby-797c46917e6a2f9faacba369b09132ddd3cc61cd.tar.gz |
internal/range.h rework
Eliminate macros for better readability.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/range.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/internal/range.h b/internal/range.h index a9101cd3f9..86ff92379a 100644 --- a/internal/range.h +++ b/internal/range.h @@ -9,10 +9,29 @@ * modify this file, provided that the conditions mentioned in the * file COPYING are met. Consult the file for details. */ +#include "internal/struct.h" /* for RSTRUCT */ /* range.c */ -#define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0]) -#define RANGE_END(r) (RSTRUCT(r)->as.ary[1]) -#define RANGE_EXCL(r) (RSTRUCT(r)->as.ary[2]) +static inline VALUE RANGE_BEG(VALUE r); +static inline VALUE RANGE_END(VALUE r); +static inline VALUE RANGE_EXCL(VALUE r); + +static inline VALUE +RANGE_BEG(VALUE r) +{ + return RSTRUCT(r)->as.ary[0]; +} + +static inline VALUE +RANGE_END(VALUE r) +{ + return RSTRUCT(r)->as.ary[1]; +} + +static inline VALUE +RANGE_EXCL(VALUE r) +{ + return RSTRUCT(r)->as.ary[2]; +} #endif /* INTERNAL_RANGE_H */ |