# HG changeset patch # User jwe # Date 1051553696 0 # Node ID cc6d369355ec5cb210098d63841d1d500501b3a4 # Parent 13619163e1597366b06db6edd4553c0df2effa10 [project @ 2003-04-28 18:14:56 by jwe] diff -r 13619163e159 -r cc6d369355ec liboctave/kpse.cc --- a/liboctave/kpse.cc Mon Apr 28 17:40:08 2003 +0000 +++ b/liboctave/kpse.cc Mon Apr 28 18:14:56 2003 +0000 @@ -1303,9 +1303,8 @@ } int len = ret.length (); - if (len > 0) - ret.resize (len - 1); + ret.resize (len-1); return ret; } @@ -1372,11 +1371,9 @@ ret += expansion + ENV_SEP_STRING; } - /* Waste the last byte by overwriting the trailing env_sep with a null. */ size_t len = ret.length (); - if (len > 0) - ret.resize (len - 1); + ret.resize (len-1); return kpse_expand_kpse_dot (ret); } @@ -1439,28 +1436,25 @@ const std::string thedir = STR_LLIST (*dir); unsigned dirlen = thedir.length (); + ret += thedir; + len += dirlen; + /* Retain trailing slash if that's the root directory. */ if (dirlen == 1 || (dirlen == 3 && NAME_BEGINS_WITH_DEVICE (thedir) && IS_DIR_SEP (thedir[2]))) { - ret += thedir + ENV_SEP_STRING; - len += dirlen + 1; - ret[len - 1] = ENV_SEP; + ret += ENV_SEP_STRING; + len++; } - else - { - ret += thedir; - len += dirlen; - ret [len - 1] = ENV_SEP; - } + + ret[len-1] = ENV_SEP; } } } - /* Get rid of trailing ':', if any. */ - if (len != 0) - ret[len - 1] = 0; + if (len > 0) + ret.resize (len-1); return ret; } diff -r 13619163e159 -r cc6d369355ec liboctave/pathsearch.cc --- a/liboctave/pathsearch.cc Mon Apr 28 17:40:08 2003 +0000 +++ b/liboctave/pathsearch.cc Mon Apr 28 18:14:56 2003 +0000 @@ -128,14 +128,8 @@ octave_kpathsea_initialized = true; } - if (p_default.empty ()) - p = kpse_path_expand (p_orig); - else - { - std::string s = kpse_expand_default (p_orig, p_default); - - p = kpse_path_expand (s); - } + p = kpse_path_expand (p_default.empty () + ? p_orig : kpse_expand_default (p_orig, p_default)); int count = 0; for (kpse_path_iterator pi (p); pi != NPOS; pi++) @@ -146,10 +140,7 @@ kpse_path_iterator pi (p); for (int i = 0; i < count; i++) - { - pv[i] = *pi++; - std::cerr << pv[i] << std::endl; - } + pv[i] = *pi++; initialized = true; }