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.
MODIFY
include/mruby/numeric.h
include/mruby/numeric.h
@@ -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);

MODIFY
src/numops.c
src/numops.c
@@ -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);

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.