[tracker-miners/wip/carlosg/dummy-files: 1/2] tracker-extract: Avoid copying a variable




commit 8d9f7fed359c49c8dcb2e73919abf932ecf75ac4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Aug 2 16:05:59 2020 +0200

    tracker-extract: Avoid copying a variable
    
    We just copy and free the mime_type variable, just don't do it.

 src/tracker-extract/tracker-extract.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index cb3935dc9..9edc6a673 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -285,7 +285,6 @@ get_file_metadata (TrackerExtractTask  *task,
 {
        TrackerExtractInfo *info;
        GFile *file;
-       gchar *mime_used = NULL;
 
        *info_out = NULL;
 
@@ -293,10 +292,7 @@ get_file_metadata (TrackerExtractTask  *task,
        info = tracker_extract_info_new (file, task->mimetype, task->graph);
        g_object_unref (file);
 
-       if (task->mimetype && *task->mimetype) {
-               /* We know the mime */
-               mime_used = g_strdup (task->mimetype);
-       } else {
+       if (!task->mimetype || !*task->mimetype) {
                tracker_extract_info_unref (info);
                return FALSE;
        }
@@ -304,17 +300,13 @@ get_file_metadata (TrackerExtractTask  *task,
        /* Now we have sanity checked everything, actually get the
         * data we need from the extractors.
         */
-       if (mime_used) {
-               if (task->func) {
-                       g_debug ("Using %s...",
-                                task->module ?
-                                g_module_name (task->module) :
-                                "Dummy extraction");
-
-                       task->success = (task->func) (info);
-               }
+       if (task->func) {
+               g_debug ("Using %s...",
+                        task->module ?
+                        g_module_name (task->module) :
+                        "Dummy extraction");
 
-               g_free (mime_used);
+               task->success = (task->func) (info);
        }
 
        if (!task->success) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]