wget_metalink_parse does not handle errors
wget_metalink_parse
accepts XML file as a string and returns a wget_metalink_t
object. However, it does not handle any error cases.
What if char *xml == NULL
? This one is easy, return an empty metalink object (or NULL
).
However, what happens when the XML file is malformed or corrupt? There is no indication to the user that the XML parsing stopped mid-way through. Instead the user simply gets a wget_metalink_t
object which has been only partially initialized. This is bad behaviour for a library. Instead, we should let the user know that parsing the file failed.