changeset 4628:8399067f9b1a

Remove few pointless string copies.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 11 Jun 2008 17:28:03 +0300
parents a7392e85d4c6
children d239bf252eac
files src/audacious/tuple.c
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/tuple.c	Wed Jun 11 13:08:58 2008 +0300
+++ b/src/audacious/tuple.c	Wed Jun 11 17:28:03 2008 +0300
@@ -159,10 +159,7 @@
     if ((value = tuple_associate_data(tuple, nfield, field, TUPLE_STRING)) == NULL)
         return FALSE;
 
-    if (string == NULL)
-        value->value.string = NULL;
-    else
-        value->value.string = g_strdup(string);
+    value->value.string = NULL;
 
     TUPLE_UNLOCK_WRITE();
     return TRUE;
@@ -179,18 +176,17 @@
     tuple = tuple_new();
     g_return_val_if_fail(tuple != NULL, NULL);
 
-    scratch = uri_to_display_basename(filename);
-    _tuple_associate_raw_string(tuple, FIELD_FILE_NAME, NULL, scratch);
-    g_free(scratch);
+    _tuple_associate_raw_string(tuple, FIELD_FILE_NAME, NULL,
+        uri_to_display_basename(filename));
 
-    scratch = uri_to_display_dirname(filename);
-    _tuple_associate_raw_string(tuple, FIELD_FILE_PATH, NULL, scratch);
-    g_free(scratch);
+    _tuple_associate_raw_string(tuple, FIELD_FILE_PATH, NULL,
+        uri_to_display_basename(filename));
     
     ext = strrchr(filename, '.');
     if (ext != NULL) {
         ++ext;
-        _tuple_associate_raw_string(tuple, FIELD_FILE_EXT, NULL, ext);
+        _tuple_associate_raw_string(tuple, FIELD_FILE_EXT, NULL,
+            g_strdup(ext));
     }
 
     return tuple;