[Mplayer-cvslog] CVS: main mplayer.c,1.672,1.673

Arpi of Ize arpi at mplayerhq.hu
Fri Feb 7 19:09:41 CET 2003


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv8082

Modified Files:
	mplayer.c 
Log Message:
Enhance portability and remove error prone usage of realloc()
patch by Björn Sandell <biorn at dce.chalmers.se>


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.672
retrieving revision 1.673
diff -u -r1.672 -r1.673
--- mplayer.c	6 Feb 2003 22:39:13 -0000	1.672
+++ mplayer.c	7 Feb 2003 18:09:29 -0000	1.673
@@ -761,21 +761,16 @@
       use_gui=0;
     }
     if (use_gui && playtree_iter){
-      char* cwd;
+      char cwd[MAXPATHLEN+2];
       // Remove Playtree and Playtree-Iter from memory as its not used by gui
       play_tree_iter_free(playtree_iter);
       playtree_iter=NULL;
       
-      if ((cwd=get_current_dir_name()))
+      if (getcwd(cwd, MAXPATHLEN) != (char *)NULL)
       {
-	cwd=(char*)realloc(cwd, strlen(cwd)+2);
-	if (cwd)
-        {
 	  strcat(cwd, "/");
           // Prefix relative paths with current working directory
           play_tree_add_bpf(playtree, cwd);
-	  free(cwd);
-	}
       }      
       // Import initital playtree into gui
       import_initial_playtree_into_gui(playtree, mconfig, enqueue);



More information about the MPlayer-cvslog mailing list