fs/AllocatedPath: make the nullptr_t constructor public

This commit is contained in:
Max Kellermann
2018-01-17 12:17:41 +01:00
parent c4f7740b80
commit bbc5212436
24 changed files with 58 additions and 62 deletions

View File

@@ -118,7 +118,7 @@ ConfigBlock::GetPath(const char *name, const char *default_value) const
s = bp->value.c_str();
} else {
if (default_value == nullptr)
return AllocatedPath::Null();
return nullptr;
s = default_value;
}

View File

@@ -125,7 +125,7 @@ config_get_path(ConfigOption option)
{
const auto *param = config_get_param(option);
if (param == nullptr)
return AllocatedPath::Null();
return nullptr;
return param->GetPath();
}

View File

@@ -71,7 +71,7 @@ config_get_string(enum ConfigOption option,
/**
* Returns an optional configuration variable which contains an
* absolute path. If there is a tilde prefix, it is expanded.
* Returns AllocatedPath::Null() if the value is not present.
* Returns nullptr if the value is not present.
*
* Throws #std::runtime_error on error.
*/

View File

@@ -86,7 +86,7 @@ ParsePath(const char *path)
if (*path == '\0')
return GetConfiguredHome();
AllocatedPath home = AllocatedPath::Null();
AllocatedPath home = nullptr;
if (*path == '/') {
home = GetConfiguredHome();
@@ -107,11 +107,11 @@ ParsePath(const char *path)
}
if (home.IsNull())
return AllocatedPath::Null();
return nullptr;
AllocatedPath path2 = AllocatedPath::FromUTF8Throw(path);
if (path2.IsNull())
return AllocatedPath::Null();
return nullptr;
return AllocatedPath::Build(home, path2);
} else if (!PathTraitsUTF8::IsAbsolute(path)) {