Skip to content

Commit 77557f0

Browse files
committed
Remove no-op free functions from schema wrapper types.
These objects are owned by the parent xmlSchemaPtr and freed when the schema is freed. The free functions were nulling a local variable then calling xmlFree(NULL) — a no-op since their introduction in 2012.
1 parent 0931b78 commit 77557f0

4 files changed

Lines changed: 4 additions & 32 deletions

File tree

ext/libxml/ruby_xml_schema_attribute.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,9 @@ struct _xmlSchemaAttributeUseProhib {
5050

5151
VALUE cXMLSchemaAttribute;
5252

53-
static void rxml_schema_attribute_free(void *data)
54-
{
55-
xmlSchemaAttributeUsePtr attr = (xmlSchemaAttributeUsePtr)data;
56-
attr = NULL;
57-
xmlFree(attr);
58-
}
59-
6053
static const rb_data_type_t rxml_schema_attribute_type = {
6154
"XML::Schema::Attribute",
62-
{NULL, rxml_schema_attribute_free, NULL},
55+
{NULL, NULL, NULL},
6356
NULL, NULL, 0
6457
};
6558

ext/libxml/ruby_xml_schema_element.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,9 @@
44

55
VALUE cXMLSchemaElement;
66

7-
static void rxml_schema_element_free(void *data)
8-
{
9-
xmlSchemaElementPtr xschema_element = (xmlSchemaElementPtr)data;
10-
xschema_element = NULL;
11-
xmlFree(xschema_element);
12-
}
13-
147
static const rb_data_type_t rxml_schema_element_type = {
158
"XML::Schema::Element",
16-
{NULL, rxml_schema_element_free, NULL},
9+
{NULL, NULL, NULL},
1710
NULL, NULL, 0
1811
};
1912

ext/libxml/ruby_xml_schema_facet.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@
77

88
VALUE cXMLSchemaFacet;
99

10-
static void rxml_schema_facet_free(void *data)
11-
{
12-
xmlSchemaFacetPtr facet = (xmlSchemaFacetPtr)data;
13-
facet = NULL;
14-
xmlFree(facet);
15-
}
16-
1710
static const rb_data_type_t rxml_schema_facet_type = {
1811
"XML::Schema::Facet",
19-
{NULL, rxml_schema_facet_free, NULL},
12+
{NULL, NULL, NULL},
2013
NULL, NULL, 0
2114
};
2215

ext/libxml/ruby_xml_schema_type.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,9 @@ a group definition, a XML_SCHEMA_EXTRA_QNAMEREF (if a reference),
4646

4747
VALUE cXMLSchemaType;
4848

49-
static void rxml_schema_type_free(void *data)
50-
{
51-
xmlSchemaTypePtr xschema_type = (xmlSchemaTypePtr)data;
52-
xschema_type = NULL;
53-
xmlFree(xschema_type);
54-
}
55-
5649
static const rb_data_type_t rxml_schema_type_type = {
5750
"XML::Schema::Type",
58-
{NULL, rxml_schema_type_free, NULL},
51+
{NULL, NULL, NULL},
5952
NULL, NULL, 0
6053
};
6154

0 commit comments

Comments
 (0)