aboutsummaryrefslogtreecommitdiffhomepage
path: root/path.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 16:50:03 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 16:50:03 -0800
commit0c9e398bef070e2841e275ce871fc1836e104711 (patch)
tree3b1025f7454b3126fcf7e4ad5196291d7d180b4b /path.cpp
parentaf2d348543f623e30376c54908cfd2eda99fb685 (diff)
Change parser_t::parse_job's args array to be a local, rather than just leak it, which no longer seems to crash
Diffstat (limited to 'path.cpp')
-rw-r--r--path.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/path.cpp b/path.cpp
index be38eaa8..60ce5c5d 100644
--- a/path.cpp
+++ b/path.cpp
@@ -328,7 +328,7 @@ bool path_get_cdpath_string(const wcstring &dir_str, wcstring &result, const env
return res;
}
-wchar_t *path_get_cdpath( void *context, const wchar_t *dir )
+wchar_t *path_allocate_cdpath( const wchar_t *dir )
{
wchar_t *res = 0;
int err = ENOENT;
@@ -343,7 +343,7 @@ wchar_t *path_get_cdpath( void *context, const wchar_t *dir )
{
if( S_ISDIR(buf.st_mode) )
{
- res = halloc_wcsdup( context, dir );
+ res = wcsdup(dir);
}
else
{
@@ -399,7 +399,6 @@ wchar_t *path_get_cdpath( void *context, const wchar_t *dir )
if( S_ISDIR(buf.st_mode) )
{
res = whole_path;
- halloc_register( context, whole_path );
break;
}
else
@@ -428,6 +427,12 @@ wchar_t *path_get_cdpath( void *context, const wchar_t *dir )
return res;
}
+bool path_can_get_cdpath(const wcstring &in) {
+ wchar_t *tmp = path_allocate_cdpath(in.c_str());
+ bool result = (tmp != NULL);
+ free(tmp);
+ return result;
+}
wchar_t *path_get_config( void *context)
{