Compare commits

..

No commits in common. "83958f020e3253948948e15df14623cca002c5d6" and "8e07c4bf6662751396651defcb4260db4fc880a6" have entirely different histories.

3 changed files with 8 additions and 23 deletions

View File

@ -21,8 +21,6 @@ G_DECLARE_DERIVABLE_TYPE(
EDJournalEntry *ed_journal_entry_new(void); EDJournalEntry *ed_journal_entry_new(void);
EDJournalEntry *ed_journal_entry_new_parse(gchar const *line, GError **error);
EDErrorCode ed_journal_entry_parse(EDJournalEntry *self, EDErrorCode ed_journal_entry_parse(EDJournalEntry *self,
gchar const *line, gchar const *line,
GError **error); GError **error);

View File

@ -45,22 +45,6 @@ EDJournalEntry *ed_journal_entry_new(void)
); );
} }
EDJournalEntry *ed_journal_entry_new_parse(gchar const *line, GError **error)
{
EDJournalEntry *e = ed_journal_entry_new();
return_if_true(e == NULL, NULL);
EDErrorCode ret = ed_error_internal;
ret = ed_journal_entry_parse(e, line, error);
if (ED_ERROR(ret)) {
g_clear_object(&e);
return NULL;
}
return e;
}
EDErrorCode ed_journal_entry_parse(EDJournalEntry *self, EDErrorCode ed_journal_entry_parse(EDJournalEntry *self,
gchar const *line, gchar const *line,
GError **error) GError **error)

View File

@ -209,7 +209,7 @@ static EDErrorCode ed_journal_file_load(EDJournalFile *self,
EDJournalFilePrivate *p = ed_journal_file_get_instance_private(self); EDJournalFilePrivate *p = ed_journal_file_get_instance_private(self);
GFile *file = NULL; GFile *file = NULL;
GFileInputStream *stream = NULL; GFileIOStream *stream = NULL;
GDataInputStream *reader = NULL; GDataInputStream *reader = NULL;
EDJournalEntry *entry = NULL; EDJournalEntry *entry = NULL;
GError *e = NULL; GError *e = NULL;
@ -219,13 +219,15 @@ static EDErrorCode ed_journal_file_load(EDJournalFile *self,
file = g_file_new_for_path(p->filename); file = g_file_new_for_path(p->filename);
goto_if_true(file == NULL, done); goto_if_true(file == NULL, done);
stream = g_file_read(file, NULL, &e); stream = g_file_open_readwrite(file, NULL, &e);
if (stream == NULL) { if (stream == NULL) {
g_propagate_error(error, e); g_propagate_error(error, e);
goto done; goto done;
} }
reader = g_data_input_stream_new(G_INPUT_STREAM(stream)); reader = g_data_input_stream_new(
g_io_stream_get_input_stream(G_IO_STREAM(stream))
);
if (reader == NULL) { if (reader == NULL) {
goto done; goto done;
} }
@ -250,12 +252,13 @@ static EDErrorCode ed_journal_file_load(EDJournalFile *self,
g_free(line); g_free(line);
line = NULL; line = NULL;
linelen = 0; linelen = 0;
continue;
} }
entry = ed_journal_entry_new_parse(line, NULL); entry = ed_journal_entry_new();
goto_if_true(entry == NULL, done); goto_if_true(entry == NULL, done);
ret = ed_journal_entry_parse(entry, line, NULL);
g_free(line); g_free(line);
line = NULL; line = NULL;
linelen = 0; linelen = 0;