# HG changeset patch # User Matti Hamalainen # Date 1213194483 -10800 # Node ID 8399067f9b1ac785e7d31e55fdc51c3780e8ac0d # Parent a7392e85d4c6bb648e8c25b7be6bf1dcd4a88491 Remove few pointless string copies. diff -r a7392e85d4c6 -r 8399067f9b1a src/audacious/tuple.c --- 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;