aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-06-13 00:12:33 +1000
committerGravatar axel <axel@liljencrantz.se>2006-06-13 00:12:33 +1000
commitd32751df13ba9707afb58eec6159835746bc18e4 (patch)
tree447ff6344786efe1fc6909f9d8b6f0ee7fa61e56 /builtin.c
parent038dcca143b8dbcee490868a1486f1ec5409574e (diff)
Use halloc in a few more places, including the highlight code
darcs-hash:20060612141233-ac50b-1c44411dd31cdc31d6ccb226f567c308c4fc0f55.gz
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/builtin.c b/builtin.c
index b57068c2..0e2849c7 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1965,7 +1965,8 @@ static int builtin_cd( wchar_t **argv )
wchar_t *dir_in;
wchar_t *dir;
int res=0;
-
+ void *context = halloc( 0, 0 );
+
if( argv[1] == 0 )
{
dir_in = env_get( L"HOME" );
@@ -1979,7 +1980,7 @@ static int builtin_cd( wchar_t **argv )
else
dir_in = argv[1];
- dir = parser_cdpath_get( dir_in );
+ dir = parser_cdpath_get( context, dir_in );
if( !dir )
{
@@ -1994,10 +1995,9 @@ static int builtin_cd( wchar_t **argv )
(void *)0 );
}
- return 1;
+ res = 1;
}
-
- if( wchdir( dir ) != 0 )
+ else if( wchdir( dir ) != 0 )
{
sb_printf( sb_err,
_( L"%ls: '%ls' is not a directory\n" ),
@@ -2010,18 +2010,15 @@ static int builtin_cd( wchar_t **argv )
(void *)0 );
}
- free( dir );
-
- return 1;
+ res = 1;
}
-
- if( !set_pwd(L"PWD") )
+ else if( !set_pwd(L"PWD") )
{
res=1;
sb_printf( sb_err, _( L"%ls: Could not set PWD variable\n" ), argv[0] );
}
- free( dir );
+ halloc_free( context );
return res;
}