Skip to content

Commit 0eb96cb

Browse files
authored
Merge pull request #698 from mame/do-not-depend-on-eval-order-of-args
Do not depend on the evaluation order of C arguments
2 parents 7c81f7d + d1e6bf3 commit 0eb96cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/psych/psych_emitter.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,12 @@ static VALUE scalar(
304304
tag = rb_str_export_to_enc(tag, encoding);
305305
}
306306

307+
const char *value_ptr = StringValuePtr(value);
307308
yaml_scalar_event_initialize(
308309
&event,
309310
(yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
310311
(yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
311-
(yaml_char_t*)StringValuePtr(value),
312+
(yaml_char_t*)value_ptr,
312313
(int)RSTRING_LEN(value),
313314
plain ? 1 : 0,
314315
quoted ? 1 : 0,

0 commit comments

Comments
 (0)