* [PATCH] string.c (rb_str_justify): use RB_GC_GUARD
@ 2015-06-24 3:43 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-06-24 3:43 UTC (permalink / raw)
To: spew
See doc/extension.rdoc for justification using RB_GC_GUARD instead
of volatile.
---
string.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/string.c b/string.c
index 4d2944c..cf5c28f 100644
--- a/string.c
+++ b/string.c
@@ -7901,7 +7901,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);
@@ -7978,6 +7978,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;
}
--
EW
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-24 3:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 3:43 [PATCH] string.c (rb_str_justify): use RB_GC_GUARD Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).