Mercurial > octave
changeset 23207:9b0a2bc07545 stable
Guarantee returning std::string from tilde_expand functions (bug #50234).
* file-ops.cc (tilde_expand_word, tild_expand): In case of short-circuit, quick
return from function guarantee that a string, not a reference to a string, is
returned.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 19 Feb 2017 20:50:42 -0800 |
parents | 525c36d5f985 |
children | 8fd8ed1e3aa2 08042580fe93 |
files | liboctave/system/file-ops.cc |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/system/file-ops.cc Sun Feb 19 19:42:44 2017 -0800 +++ b/liboctave/system/file-ops.cc Sun Feb 19 20:50:42 2017 -0800 @@ -227,7 +227,7 @@ size_t f_len = filename.length (); if (f_len == 0 || filename[0] != '~') - return filename; + return std::string (filename); // A leading '~/' or a bare '~' is *always* translated to the value // of $HOME or the home directory of the current user, regardless of @@ -301,7 +301,7 @@ octave::sys::file_ops::tilde_expand (const std::string& name) { if (name.find ('~') == std::string::npos) - return name; + return std::string (name); else { std::string result;