[latexila] PostProcessorLatex: more robust code for the filename_buffer
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] PostProcessorLatex: more robust code for the filename_buffer
- Date: Mon, 6 Oct 2014 20:05:16 +0000 (UTC)
commit 8060c168c40dad21be8426e057d1a19902eba535
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Oct 6 22:04:06 2014 +0200
PostProcessorLatex: more robust code for the filename_buffer
src/liblatexila/latexila-post-processor-latex.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/liblatexila/latexila-post-processor-latex.c b/src/liblatexila/latexila-post-processor-latex.c
index c786909..c7b2b89 100644
--- a/src/liblatexila/latexila-post-processor-latex.c
+++ b/src/liblatexila/latexila-post-processor-latex.c
@@ -179,8 +179,10 @@ static void
append_to_filename_buffer (LatexilaPostProcessorLatex *pp,
const gchar *content)
{
- g_return_if_fail (pp->priv->filename_buffer != NULL);
- g_string_append (pp->priv->filename_buffer, content);
+ if (pp->priv->filename_buffer == NULL)
+ set_filename_buffer (pp, content);
+ else
+ g_string_append (pp->priv->filename_buffer, content);
}
static gchar *
@@ -1151,6 +1153,9 @@ update_stack_file_heuristic (LatexilaPostProcessorLatex *pp,
{
gint pos;
+ if (pp->priv->filename_buffer == NULL)
+ set_filename_buffer (pp, "");
+
g_string_append_len (pp->priv->filename_buffer,
start_filename,
line_pos_next - start_filename);
@@ -1192,10 +1197,11 @@ update_stack_file_heuristic (LatexilaPostProcessorLatex *pp,
{
pp->priv->state = STATE_START;
- /* TODO ensure that filename_buffer is correctly initialized when
- * using it.
- */
- set_filename_buffer (pp, "");
+ if (pp->priv->filename_buffer != NULL)
+ {
+ g_string_free (pp->priv->filename_buffer, TRUE);
+ pp->priv->filename_buffer = NULL;
+ }
expect_filename = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]