[macruby-changes] [2184] MacRuby/branches/experimental/ext/libyaml/rubyext.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 3 10:46:02 PDT 2009


Revision: 2184
          http://trac.macosforge.org/projects/ruby/changeset/2184
Author:   pthomson at apple.com
Date:     2009-08-03 10:46:01 -0700 (Mon, 03 Aug 2009)
Log Message:
-----------
Putting in some checks to validate that nodes get added to documents correctly.

Modified Paths:
--------------
    MacRuby/branches/experimental/ext/libyaml/rubyext.c

Modified: MacRuby/branches/experimental/ext/libyaml/rubyext.c
===================================================================
--- MacRuby/branches/experimental/ext/libyaml/rubyext.c	2009-08-03 17:46:00 UTC (rev 2183)
+++ MacRuby/branches/experimental/ext/libyaml/rubyext.c	2009-08-03 17:46:01 UTC (rev 2184)
@@ -172,6 +172,10 @@
 	// TODO: stop ignoring the style parameter
 	yaml_char_t *tag = (yaml_char_t*)RSTRING_PTR(taguri);
 	int nodeID = yaml_document_add_sequence(document, tag, YAML_ANY_SEQUENCE_STYLE);
+	if (nodeID == 0)
+	{
+		rb_exc_raise(rb_yaml_parser_error(self, sel));
+	}
 	if (rb_block_given_p())
 	{
 		yaml_node_t *node = yaml_document_get_node(document, nodeID);
@@ -188,6 +192,10 @@
 	yaml_document_t *document = (yaml_document_t*)DATA_PTR(self);
 	yaml_char_t *tag = (yaml_char_t*)RSTRING_PTR(taguri);
 	int nodeID = yaml_document_add_mapping(document, tag, YAML_ANY_MAPPING_STYLE);
+	if (nodeID == 0)
+	{
+		rb_exc_raise(rb_yaml_parser_error(self, sel));
+	}
 	if (rb_block_given_p())
 	{
 		yaml_node_t *node = yaml_document_get_node(document, nodeID);
@@ -225,6 +233,10 @@
 	yaml_char_t *tag = (yaml_char_t*)RSTRING_PTR(taguri);
 	yaml_char_t *val = (yaml_char_t*)RSTRING_PTR(str);
 	int scalID = yaml_document_add_scalar(document, NULL, val, RSTRING_LEN(str), rb_symbol_to_scalar_style(style));
+	if (scalID == 0)
+	{
+		rb_exc_raise(rb_yaml_parser_error(self, sel));
+	}
 	return rb_yaml_node_new(yaml_document_get_node(document, scalID), scalID, self);
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090803/553aab97/attachment-0001.html>


More information about the macruby-changes mailing list