diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2007-10-27 16:31:35 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2007-10-27 17:22:17 +0200 |
commit | c737b17fa80e411916ffa21553926718c96effbb (patch) | |
tree | 705be9a86a0d613299ab2b11ff6c736db8a3767f /libspectre/spectre-document.c | |
parent | caf81f64e573c05f0082026383f1859bbef950ba (diff) |
Open and close the file in psscan instead of spectre_document_load
Diffstat (limited to 'libspectre/spectre-document.c')
-rw-r--r-- | libspectre/spectre-document.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/libspectre/spectre-document.c b/libspectre/spectre-document.c index 0692fac..75f8163 100644 --- a/libspectre/spectre-document.c +++ b/libspectre/spectre-document.c @@ -45,8 +45,6 @@ void spectre_document_load (SpectreDocument *document, const char *filename) { - FILE *fd; - if (document->doc && strcmp (filename, document->doc->filename) == 0) { document->status = SPECTRE_STATUS_SUCCESS; return; @@ -57,24 +55,13 @@ spectre_document_load (SpectreDocument *document, document->doc = NULL; } - fd = fopen (filename, "r"); - if (!fd) { - document->status = SPECTRE_STATUS_LOAD_ERROR; - return; - } - - document->doc = psscan (fd, filename, SCANSTYLE_NORMAL); + document->doc = psscan (filename, SCANSTYLE_NORMAL); if (!document->doc) { /* FIXME: OOM | INVALID_PS */ document->status = SPECTRE_STATUS_LOAD_ERROR; return; } - if (!fclose (fd)) { - document->status = SPECTRE_STATUS_LOAD_ERROR; - return; - } - if (document->status != SPECTRE_STATUS_SUCCESS) document->status = SPECTRE_STATUS_SUCCESS; } |