changeset 9315:544c285a5493

Enhance portability and remove error prone usage of realloc() patch by Bj«Órn Sandell <biorn@dce.chalmers.se>
author arpi
date Fri, 07 Feb 2003 18:09:29 +0000
parents f38fe55d0e05
children 7a0d466a51a8
files mplayer.c
diffstat 1 files changed, 2 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Fri Feb 07 18:06:16 2003 +0000
+++ b/mplayer.c	Fri Feb 07 18:09:29 2003 +0000
@@ -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);