aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-06-06 10:19:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-06-06 10:19:59 +0200
commitc03300fe14e5caffbee87565b76a64febfc4313a (patch)
tree763fed7e70221bba382705dcb125a10878c55e4b
parent7fde0c7f2b0c41300d38187140cc5a5c952e224b (diff)
Use small_vector in path::normalize()
-rw-r--r--libbutl/path.cxx4
-rw-r--r--libbutl/path.mxx3
-rw-r--r--libbutl/path.txx2
3 files changed, 5 insertions, 4 deletions
diff --git a/libbutl/path.cxx b/libbutl/path.cxx
index f027233..608f309 100644
--- a/libbutl/path.cxx
+++ b/libbutl/path.cxx
@@ -29,7 +29,6 @@
#ifndef __cpp_lib_modules_ts
#include <string>
-#include <vector>
#include <cstddef>
#include <utility>
@@ -124,7 +123,8 @@ namespace butl
}
#ifndef _WIN32
- static const vector<string> tmp_vars ({"TMPDIR", "TMP", "TEMP", "TEMPDIR"});
+ static const small_vector<string, 4> tmp_vars (
+ {"TMPDIR", "TMP", "TEMP", "TEMPDIR"});
static string
temp_directory ()
diff --git a/libbutl/path.mxx b/libbutl/path.mxx
index d5dde59..2de85e9 100644
--- a/libbutl/path.mxx
+++ b/libbutl/path.mxx
@@ -16,7 +16,6 @@
#include <stdexcept> // invalid_argument
#include <functional> // hash
-#include <vector>
#ifdef _WIN32
#include <algorithm> // replace()
#endif
@@ -29,10 +28,12 @@ export module butl.path;
#ifdef __cpp_lib_modules_ts
import std.core;
#endif
+import butl.small_vector;
#ifdef _WIN32
import butl.utility;
#endif
#else
+#include <libbutl/small-vector.mxx>
#ifdef _WIN32
#include <libbutl/utility.mxx> // *case*()
#endif
diff --git a/libbutl/path.txx b/libbutl/path.txx
index e407a16..77fbbd7 100644
--- a/libbutl/path.txx
+++ b/libbutl/path.txx
@@ -151,7 +151,7 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason.
string_type& s (this->path_);
difference_type& ts (this->tsep_);
- typedef std::vector<string_type> paths;
+ using paths = small_vector<string_type, 16>;
paths ps;
bool tsep (ts != 0); // Trailing directory separator.