[tracker/tracker-0.12] tracker-miner-fs: Avoid unnecessary string copies
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.12] tracker-miner-fs: Avoid unnecessary string copies
- Date: Fri, 25 Nov 2011 15:48:38 +0000 (UTC)
commit 2cccbf8d3cd4fa3e7346df7b0dc177c54581e3e4
Author: JÃrg Billeter <j bitron ch>
Date: Thu Nov 24 10:46:41 2011 +0100
tracker-miner-fs: Avoid unnecessary string copies
src/miners/fs/tracker-miner-userguides.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-userguides.c b/src/miners/fs/tracker-miner-userguides.c
index 700ca53..2d8e91d 100644
--- a/src/miners/fs/tracker-miner-userguides.c
+++ b/src/miners/fs/tracker-miner-userguides.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]