Use appropriate xmlChar type to avoid unnecessary casting.
@@ -13,7 +13,7 @@ static void rxml_schema_attribute_free(xmlSchemaAttributeUsePtr attr)
VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr)
{
VALUE class;
- const char *tns_str, *name_str;
+ const xmlChar *tns_str, *name_str;
if (!attr)
rb_raise(rb_eArgError, "XML::Schema::Attribute required!");
@@ -21,14 +21,14 @@ VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr)
class = Data_Wrap_Struct(cXMLSchemaAttribute, NULL, rxml_schema_attribute_free, attr);
if (attr->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
- tns_str = (const char *)(((xmlSchemaAttributeUseProhibPtr) attr)->targetNamespace);
- name_str = (const char *)(((xmlSchemaAttributeUseProhibPtr) attr)->name);
+ tns_str = ((xmlSchemaAttributeUseProhibPtr) attr)->targetNamespace;
+ name_str = ((xmlSchemaAttributeUseProhibPtr) attr)->name;
} else if (attr->type == XML_SCHEMA_EXTRA_QNAMEREF) {
- tns_str = (const char *)(((xmlSchemaQNameRefPtr) attr)->targetNamespace);
- name_str = (const char *)(((xmlSchemaQNameRefPtr) attr)->name);
+ tns_str = ((xmlSchemaQNameRefPtr) attr)->targetNamespace;
+ name_str = ((xmlSchemaQNameRefPtr) attr)->name;
} else {
- tns_str = (const char *)((xmlSchemaAttributePtr) (attr->attrDecl)->targetNamespace);
- name_str = (const char *)((xmlSchemaAttributePtr) (attr->attrDecl)->name);
+ tns_str = ((xmlSchemaAttributePtr) (attr->attrDecl))->targetNamespace;
+ name_str = ((xmlSchemaAttributePtr) (attr->attrDecl))->name;
}
rb_iv_set(class, "@target_namespace", QNIL_OR_STRING(tns_str));
rb_iv_set(class, "@name", QNIL_OR_STRING(name_str));
