зеркало из https://github.com/github/ruby.git
internal/range.h rework
Eliminate macros for better readability.
This commit is contained in:
Родитель
719efe72b0
Коммит
797c46917e
|
@ -9,10 +9,29 @@
|
||||||
* modify this file, provided that the conditions mentioned in the
|
* modify this file, provided that the conditions mentioned in the
|
||||||
* file COPYING are met. Consult the file for details.
|
* file COPYING are met. Consult the file for details.
|
||||||
*/
|
*/
|
||||||
|
#include "internal/struct.h" /* for RSTRUCT */
|
||||||
|
|
||||||
/* range.c */
|
/* range.c */
|
||||||
#define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0])
|
static inline VALUE RANGE_BEG(VALUE r);
|
||||||
#define RANGE_END(r) (RSTRUCT(r)->as.ary[1])
|
static inline VALUE RANGE_END(VALUE r);
|
||||||
#define RANGE_EXCL(r) (RSTRUCT(r)->as.ary[2])
|
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 */
|
#endif /* INTERNAL_RANGE_H */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче