mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
numops.c: rename functions for addition and subtraction.
To more consistent names. * mrb_num_plus() -> mrb_num_add() * mrb_num_minus() -> mrb_num_sub() Since no one seems to use those functions, there should be no problem. We added migration macros for compatibility for safety.
This commit is contained in:
@@ -30,9 +30,13 @@ MRB_BEGIN_DECL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
MRB_API mrb_value mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
MRB_API mrb_value mrb_num_minus(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
/* utility functions */
|
||||
MRB_API mrb_value mrb_num_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
MRB_API mrb_value mrb_num_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
/* obsolete old names */
|
||||
#define mrb_num_plus(mrb, x, y) mrb_num_add(mrb, x, y)
|
||||
#define mrb_num_minus(mrb, x, y) mrb_num_sub(mrb, x, y)
|
||||
|
||||
MRB_API mrb_value mrb_integer_to_str(mrb_state *mrb, mrb_value x, mrb_int base);
|
||||
MRB_API char *mrb_int_to_cstr(char *buf, size_t len, mrb_int n, mrb_int base);
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ mrb_value mrb_rational_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
|
||||
MRB_API mrb_value
|
||||
mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||
mrb_num_add(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||
{
|
||||
if (mrb_integer_p(x)) {
|
||||
return mrb_int_add(mrb, x, y);
|
||||
@@ -47,7 +47,7 @@ mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||
}
|
||||
|
||||
MRB_API mrb_value
|
||||
mrb_num_minus(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||
mrb_num_sub(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||
{
|
||||
if (mrb_integer_p(x)) {
|
||||
return mrb_int_sub(mrb, x, y);
|
||||
|
||||
Reference in New Issue
Block a user