summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-24 07:17:44 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-24 07:17:44 (GMT)
commita12fb26ff7218d66a5062bc97d1fad6c34678ef6 (patch)
tree35acc7d17f55a4e1a742e2803f2026cf1751debf /string.c
parent8b0cfe9042aa04a8f574fe4169ecea43b550b638 (diff)
string.c (rb_str_justify): use RB_GC_GUARD
See doc/extension.rdoc for justification using RB_GC_GUARD instead of volatile. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/string.c b/string.c
index 1a96215..34c77a5 100644
--- a/string.c
+++ b/string.c
@@ -7908,7 +7908,7 @@ rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
char *p;
const char *f = " ";
long n, size, llen, rlen, llen2 = 0, rlen2 = 0;
- volatile VALUE pad;
+ VALUE pad;
int singlebyte = 1, cr;
rb_scan_args(argc, argv, "11", &w, &pad);
@@ -7985,6 +7985,8 @@ rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
cr = ENC_CODERANGE_AND(cr, ENC_CODERANGE(pad));
if (cr != ENC_CODERANGE_BROKEN)
ENC_CODERANGE_SET(res, cr);
+
+ RB_GC_GUARD(pad);
return res;
}