Skip to content
Permalink
Browse files

Make unused functions private.

* mrb_fixnum_plus()
* mrb_fixnum_minus()
* mrb_fixnum_mul()
  • Loading branch information
matz committed May 17, 2019
1 parent 0d61bcd commit 237a57bbe831c57d3ebb0f9cc69768dbc8dda589
Showing with 3 additions and 7 deletions.
  1. +0 −4 include/mruby/numeric.h
  2. +3 −3 src/numeric.c
@@ -36,10 +36,6 @@ MRB_API mrb_value mrb_float_to_str(mrb_state *mrb, mrb_value x, const char *fmt)
MRB_API mrb_float mrb_to_flo(mrb_state *mrb, mrb_value x);
#endif

mrb_value mrb_fixnum_plus(mrb_state *mrb, mrb_value x, mrb_value y);
mrb_value mrb_fixnum_minus(mrb_state *mrb, mrb_value x, mrb_value y);
mrb_value mrb_fixnum_mul(mrb_state *mrb, mrb_value x, mrb_value y);

#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
@@ -787,7 +787,7 @@ int_to_i(mrb_state *mrb, mrb_value num)
return num;
}

mrb_value
static mrb_value
mrb_fixnum_mul(mrb_state *mrb, mrb_value x, mrb_value y)
{
mrb_int a;
@@ -1244,7 +1244,7 @@ mrb_flo_to_fixnum(mrb_state *mrb, mrb_value x)
}
#endif

mrb_value
static mrb_value
mrb_fixnum_plus(mrb_state *mrb, mrb_value x, mrb_value y)
{
mrb_int a;
@@ -1287,7 +1287,7 @@ fix_plus(mrb_state *mrb, mrb_value self)
return mrb_fixnum_plus(mrb, self, other);
}

mrb_value
static mrb_value
mrb_fixnum_minus(mrb_state *mrb, mrb_value x, mrb_value y)
{
mrb_int a;

5 comments on commit 237a57b

@Asmod4n

This comment has been minimized.

Copy link
Contributor

Asmod4n replied May 19, 2019

@matz i need mrb_fixnum_mul to check for overflow in mruby versions which don't have mrb_int_mul_overflow

@matz

This comment has been minimized.

Copy link
Member Author

matz replied May 19, 2019

Only mrb_fixnum_mul? Or revert the commit altogether?

@Asmod4n

This comment has been minimized.

Copy link
Contributor

Asmod4n replied May 19, 2019

I‘d revert it, there might be others who could need them :)

@matz

This comment has been minimized.

Copy link
Member Author

matz replied May 20, 2019

Could you use the new MRB_API function mrb_num_mul() for multiplication? The old mrb_fixnum_mul() was intended for internal use.

@Asmod4n

This comment has been minimized.

Copy link
Contributor

Asmod4n replied May 20, 2019

Can do, thanks.

Please sign in to comment.
You can’t perform that action at this time.