Enhance portability and remove error prone usage of realloc()

patch by Björn Sandell <biorn@dce.chalmers.se>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9316 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2003-02-07 18:09:29 +00:00
parent fc52bafec0
commit d90e9cb669
1 changed files with 2 additions and 7 deletions

View File

@ -761,21 +761,16 @@ int gui_no_filename=0;
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);