Commit 4b940d99 authored by Jürg Billeter's avatar Jürg Billeter Committed by Martyn Russell

tracker-miner-fs: Avoid unnecessary string copies

parent c8cb892e
......@@ -536,19 +536,17 @@ parser_characters (void *ctx,
int len G_GNUC_UNUSED)
{
ParserContext *pctx = ctx;
gchar *str;
const gchar *str;
int len_to_append;
if (pctx->in_title) {
gchar *title = g_strdup ((const gchar *) ch);
const gchar *title = (const gchar *) ch;
if (title[0]) {
g_string_append_len (pctx->title,
title,
MIN(strlen (title), MAX_TITLE_LENGTH));
}
g_free(title);
}
if (!pctx->in_text) {
......@@ -559,10 +557,9 @@ parser_characters (void *ctx,
return;
}
str = g_strdup ((const gchar *) ch);
str = (const gchar *) ch;
if (!str || !str[0]) {
g_free (str);
return;
}
......@@ -573,7 +570,6 @@ parser_characters (void *ctx,
}
g_string_append_len (pctx->plain_text, str, len_to_append);
g_free (str);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment