changeset 2513:a4629703edc3

Remove completely wtf pointer nulling. Variables don't magically change their state; if it seems like that, then there is a bug somewhere.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 02 Apr 2008 23:02:09 +0300
parents 1f6b5f5768e2
children bad05467e8e0
files src/madplug/input.c
diffstat 1 files changed, 8 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug/input.c	Wed Apr 02 22:58:35 2008 +0300
+++ b/src/madplug/input.c	Wed Apr 02 23:02:09 2008 +0300
@@ -138,7 +138,7 @@
 id3_ucs4_t *
 mad_ucs4dup(id3_ucs4_t *org)
 {
-    id3_ucs4_t *res = NULL;
+    id3_ucs4_t *res;
     size_t len = mad_ucs4len(org);
 
     res = g_malloc0((len + 1) * sizeof(id3_ucs4_t));
@@ -352,7 +352,7 @@
 static void
 input_read_tag(struct mad_info_t *info)
 {
-    gchar *string = NULL;
+    gchar *string;
     Tuple *tuple;
     glong curpos = 0;
 
@@ -360,7 +360,7 @@
 
     if (info->tuple != NULL)
         aud_tuple_free(info->tuple);
-        
+    
     tuple = aud_tuple_new_from_filename(info->filename);
     info->tuple = tuple;
 
@@ -393,11 +393,9 @@
     if (string) {
         aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, atoi(string));
         g_free(string);
-        string = NULL;
     }
 
     // year
-    string = NULL;
     string = input_id3_get_string(info->tag, ID3_FRAME_YEAR);   //TDRC
     if (!string)
         string = input_id3_get_string(info->tag, "TYER");
@@ -405,7 +403,6 @@
     if (string) {
         aud_tuple_associate_int(tuple, FIELD_YEAR, NULL, atoi(string));
         g_free(string);
-        string = NULL;
     }
 
     // length
@@ -414,7 +411,6 @@
         aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, atoi(string));
         AUDDBG("input_read_tag: TLEN = %d\n", atoi(string));
         g_free(string);
-        string = NULL;
     } else
         aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, -1);
     
@@ -439,7 +435,7 @@
     gboolean metadata = FALSE;
 
     if(info->remote && mad_timer_count(info->duration, MAD_UNITS_SECONDS) <= 0){
-        gchar *tmp = NULL;
+        gchar *tmp;
 
 #ifdef DEBUG_INTENSIVELY
         AUDDBG("process_remote_meta\n");
@@ -452,28 +448,20 @@
         tmp = aud_vfs_get_metadata(info->infile, "track-name");
         if(tmp){
             metadata = TRUE;
-            gchar *scratch;
-
-            scratch = aud_str_to_utf8(tmp);
+            gchar *scratch = aud_str_to_utf8(tmp);
             aud_tuple_associate_string(info->tuple, FIELD_TITLE, NULL, scratch);
             g_free(scratch);
-
             g_free(tmp);
-            tmp = NULL;
         }
 
         tmp = aud_vfs_get_metadata(info->infile, "stream-name");
         if(tmp){
             metadata = TRUE;
-            gchar *scratch;
-
-            scratch = aud_str_to_utf8(tmp);
+            gchar *scratch = aud_str_to_utf8(tmp);
             aud_tuple_associate_string(info->tuple, FIELD_ALBUM, NULL, scratch);
             aud_tuple_associate_string(info->tuple, -1, "stream", scratch);
             g_free(scratch);
-
             g_free(tmp);
-            tmp = NULL;
         }
 
         if (metadata)
@@ -482,8 +470,8 @@
             gchar *realfn = g_filename_from_uri(info->filename, NULL, NULL);
             gchar *tmp2 = g_path_get_basename(realfn ? realfn : info->filename); // info->filename is uri. --yaz
             tmp = aud_str_to_utf8(tmp2);
-            g_free(tmp2); tmp2 = NULL;
-            g_free(realfn); realfn = NULL;
+            g_free(tmp2);
+            g_free(realfn);
 //            tmp = g_strdup(g_basename(info->filename)); //XXX maybe ok. --yaz
         }