[前][次][番号順一覧][スレッド一覧]

ruby-changes:56818

From: Yusuke <ko1@a...>
Date: Mon, 5 Aug 2019 14:39:18 +0900 (JST)
Subject: [ruby-changes:56818] Yusuke Endoh: 58a478bce4 (master): ext/psych/yaml/loader.c: Cast the difference of pointers to int

https://git.ruby-lang.org/ruby.git/commit/?id=58a478bce4

From 58a478bce4a81e619dcef4436f437453d1a3cd89 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Mon, 5 Aug 2019 14:37:53 +0900
Subject: ext/psych/yaml/loader.c: Cast the difference of pointers to int

instead of casting a pointer to int.
Follow up of 39622232c7542d062f79277a11f6b8b6b6cfd994.

diff --git a/ext/psych/yaml/loader.c b/ext/psych/yaml/loader.c
index aa75cf5..e5d90be 100644
--- a/ext/psych/yaml/loader.c
+++ b/ext/psych/yaml/loader.c
@@ -300,7 +300,7 @@ yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event) https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/loader.c#L300
 
     if (!PUSH(parser, parser->document->nodes, node)) goto error;
 
-    index = (int)parser->document->nodes.top - (int)parser->document->nodes.start;
+    index = (int)(parser->document->nodes.top - parser->document->nodes.start);
 
     if (!yaml_parser_register_anchor(parser, index,
                 first_event->data.scalar.anchor)) return 0;
@@ -347,7 +347,7 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event) https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/loader.c#L347
 
     if (!PUSH(parser, parser->document->nodes, node)) goto error;
 
-    index = (int)parser->document->nodes.top - (int)parser->document->nodes.start;
+    index = (int)(parser->document->nodes.top - parser->document->nodes.start);
 
     if (!yaml_parser_register_anchor(parser, index,
                 first_event->data.sequence_start.anchor)) return 0;
@@ -410,7 +410,7 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event) https://github.com/ruby/ruby/blob/trunk/ext/psych/yaml/loader.c#L410
 
     if (!PUSH(parser, parser->document->nodes, node)) goto error;
 
-    index = (int)parser->document->nodes.top - (int)parser->document->nodes.start;
+    index = (int)(parser->document->nodes.top - parser->document->nodes.start);
 
     if (!yaml_parser_register_anchor(parser, index,
                 first_event->data.mapping_start.anchor)) return 0;
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]