Merge branch 'open-files' of git://github.com/nathansamson/diveclog

* 'open-files' of git://github.com/nathansamson/diveclog:
  Report errors when opening files
  Make it possible to load multiple files at once.
  Open File works. I refactored the code and introduced a new type. I never used it as a pointer (their was no real reason), but I'm not really satisfied.
This commit is contained in:
Linus Torvalds 2011-09-05 14:44:27 -07:00
commit c24fd4b82c
10 changed files with 163 additions and 56 deletions

View file

@ -1228,13 +1228,20 @@ static void reset_all(void)
import_source = UNKNOWN;
}
void parse_xml_file(const char *filename)
void parse_xml_file(const char *filename, GError **error)
{
xmlDoc *doc;
doc = xmlReadFile(filename, NULL, 0);
if (!doc) {
fprintf(stderr, "Failed to parse '%s'.\n", filename);
if (error != NULL)
{
*error = g_error_new(g_quark_from_string("divelog"),
DIVE_ERROR_PARSE,
"Failed to parse '%s'",
filename);
}
return;
}