diff options
| author | John Hawthorn <john@hawthorn.email> | 2025-11-03 15:48:28 -0800 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2025-12-05 06:21:17 -0800 |
| commit | 930afa1c7ba747658cc4253c2cb6a367d7a6a36b (patch) | |
| tree | 3a9df89c2a1cc0fe4f8aa77651bdc62c8e4f04d5 | |
| parent | b0c9286d98929db56514d8009040fe206b3d310f (diff) | |
Never shrink bignum on realloc
As far as I can tell, this only ever shrinks by one, and it's really not
worth the expensive realloc for that.
| -rw-r--r-- | bignum.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -3048,7 +3048,7 @@ rb_big_realloc(VALUE big, size_t len) if (BIGNUM_LEN(big) == 0) { RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len); } - else { + else if (BIGNUM_LEN(big) < len) { REALLOC_N(RBIGNUM(big)->as.heap.digits, BDIGIT, len); } } |
