-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxml.c
More file actions
47 lines (37 loc) · 688 Bytes
/
xml.c
File metadata and controls
47 lines (37 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "xml.h"
#include <stdlib.h>
int
xml_attribute_free (const XmlAttribute *attribute)
{
free (attribute->name);
free (attribute->value);
return 0;
}
int
xml_attribute_init (XmlAttribute *attribute)
{
if ((attribute->name = malloc (sizeof (*attribute->name))) == NULL)
{
return -1;
}
if ((attribute->value = malloc (sizeof (*attribute->value))) == NULL)
{
return -1;
}
return 0;
}
int
xml_document_free (const XmlDocument *document)
{
free (document->root);
return 0;
}
int
xml_document_init (XmlDocument *document)
{
if ((document->root = malloc (sizeof (*document->root))) == NULL)
{
return -1;
}
return 0;
}