From ad801af7a975a5400f798c77d3d9cdaf3ed5121a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 25 Jul 2019 17:34:11 +0300 Subject: Use butl::small_vector instead of std::vector where it makes sense --- libbpkg/manifest.cxx | 2 +- libbpkg/manifest.hxx | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index e27af54..bba616f 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -1665,7 +1665,7 @@ namespace bpkg // manifest_parsing otherwise. // auto parse_list = [&bad_name, &bad_value] (const string& v, - strings& r, + small_vector& r, char delim, bool single_word, bool truncate, diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index 9493ee0..c0901e9 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -240,7 +241,7 @@ namespace bpkg // license // - class licenses: public strings + class licenses: public butl::small_vector { public: std::string comment; @@ -367,7 +368,7 @@ namespace bpkg LIBBPKG_EXPORT std::ostream& operator<< (std::ostream&, const dependency&); - class dependency_alternatives: public std::vector + class dependency_alternatives: public butl::small_vector { public: bool conditional; @@ -384,7 +385,7 @@ namespace bpkg // requires // - class requirement_alternatives: public strings + class requirement_alternatives: public butl::small_vector { public: bool conditional; @@ -644,12 +645,18 @@ namespace bpkg butl::optional project; butl::optional priority; std::string summary; + + // @@ Replace with small_vector. Note that currently it is + // unsupported by the odb::nested_*() functions that are + // std::vector-specific. + // std::vector license_alternatives; - strings topics; - strings keywords; + + butl::small_vector topics; + butl::small_vector keywords; butl::optional description; butl::optional description_type; - std::vector changes; + butl::small_vector changes; butl::optional url; butl::optional doc_url; butl::optional src_url; @@ -661,7 +668,7 @@ namespace bpkg butl::optional build_error_email; std::vector dependencies; std::vector requirements; - std::vector builds; + butl::small_vector builds; std::vector build_constraints; // The following values are only valid in the manifest list (and only for @@ -1295,7 +1302,7 @@ namespace bpkg default_refs () const {return !name && !commit;} }; - using git_ref_filters = std::vector; + using git_ref_filters = butl::small_vector; // Parse a comma-separated list of git reference filters. If the argument // starts with the '#' character then prepend the resulting list with the -- cgit v1.1