Skip to content

Instantly share code, notes, and snippets.

@henrik
Last active August 29, 2015 13:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save henrik/10880288 to your computer and use it in GitHub Desktop.
Save henrik/10880288 to your computer and use it in GitHub Desktop.
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c (revision 45014)
+++ ext/bigdecimal/bigdecimal.c (revision 45015)
@@ -2467,9 +2467,11 @@
static VALUE
BigDecimal_initialize(int argc, VALUE *argv, VALUE self)
{
+ ENTER(1);
Real *pv = rb_check_typeddata(self, &BigDecimal_data_type);
- Real *x = BigDecimal_new(argc, argv);
+ Real *x;
+ GUARD_OBJ(x, BigDecimal_new(argc, argv));
if (ToValue(x)) {
pv = VpCopy(pv, x);
}
@@ -2548,7 +2550,10 @@
static VALUE
BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
{
- Real *pv = BigDecimal_new(argc, argv);
+ ENTER(1);
+ Real *pv;
+
+ GUARD_OBJ(pv, BigDecimal_new(argc, argv));
if (ToValue(pv)) pv = VpCopy(NULL, pv);
pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv);
return pv->obj;
# 1. Get the source however you like
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
tar xfz ruby-2.1.1.tar.gz
cd ruby-2.1.1

# 2. Apply this patch! This is the interesting part.
curl https://gist.githubusercontent.com/henrik/10880288/raw/fe228cf0524873c992fa5c31b1173537dca76a2c/patch.diff | patch -p0

# 3. Build it however you like
# …
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment