Permalink
Browse files

Cleanup in preparation for adding complexity.

  • Loading branch information...
1 parent 2d5dcca commit dfca83456d8b3ecbf253d56ba86f760460065000 @flavorjones flavorjones committed Oct 19, 2012
Showing with 9 additions and 10 deletions.
  1. +9 −10 ext/nokogiri/xml_node.c
View
19 ext/nokogiri/xml_node.c
@@ -702,20 +702,19 @@ static VALUE set(VALUE self, VALUE property, VALUE value)
static VALUE get(VALUE self, VALUE attribute)
{
xmlNodePtr node;
- xmlChar* propstr ;
- VALUE rval ;
- Data_Get_Struct(self, xmlNode, node);
-
- if(NIL_P(attribute)) return Qnil;
+ xmlChar* value ;
+ VALUE rvalue ;
- propstr = xmlGetProp(node, (xmlChar *)StringValuePtr(attribute));
+ if (NIL_P(attribute)) return Qnil;
- if(!propstr) return Qnil;
+ Data_Get_Struct(self, xmlNode, node);
+ value = xmlGetProp(node, (xmlChar *)StringValuePtr(attribute));
+ if (!value) return Qnil;
- rval = NOKOGIRI_STR_NEW2(propstr);
+ rvalue = NOKOGIRI_STR_NEW2(value);
+ xmlFree(value);
- xmlFree(propstr);
- return rval ;
+ return rvalue ;
}
/*

0 comments on commit dfca834

Please sign in to comment.