aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2011-10-09 16:15:52 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2011-10-14 23:04:29 +0100
commitf672fa2b53cf66a1b820b282f2382ea6b3a5f017 (patch)
treeee8bd0562084242e295b82c160df855beb67b703
parent6779001d17d4a16ddd1a5cf0f6300307dddd18a5 (diff)
downloadpaludis-f672fa2b53cf66a1b820b282f2382ea6b3a5f017.tar.gz
paludis-f672fa2b53cf66a1b820b282f2382ea6b3a5f017.tar.xz
Use nice new toupper/tolower functions
-rw-r--r--paludis/args/man.cc6
-rw-r--r--paludis/environments/portage/portage_environment.cc6
-rw-r--r--paludis/repositories/e/e_choices_key.cc10
-rw-r--r--paludis/repositories/e/ebuild_id.cc5
-rw-r--r--paludis/repositories/e/fetch_visitor.cc5
-rw-r--r--paludis/repositories/e/traditional_profile.cc15
-rw-r--r--python/paludis_python.hh5
7 files changed, 18 insertions, 34 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index d33a7f7..aa2d4ac 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -19,13 +19,13 @@
*/
#include "man.hh"
+#include <paludis/util/upper_lower.hh>
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <functional>
#include <ostream>
#include <sstream>
#include <algorithm>
-#include <ctype.h>
using namespace paludis;
using namespace paludis::args;
@@ -291,9 +291,7 @@ AsciidocWriter::end_description()
void
AsciidocWriter::start_options(const std::string & s)
{
- std::string upper_s;
- std::transform(s.begin(), s.end(), std::back_inserter(upper_s), &::toupper);
- _os << upper_s << endl;
+ _os << toupper(s) << endl;
_os << std::string(s.size(), char('-')) << endl;
}
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 0d15f52..4a590b8 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -43,6 +43,7 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/env_var_names.hh>
#include <paludis/util/join.hh>
+#include <paludis/util/upper_lower.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/hooker.hh>
@@ -65,7 +66,6 @@
#include <vector>
#include <list>
-#include <ctype.h>
#include <sys/types.h>
#include <grp.h>
#include <pwd.h>
@@ -303,9 +303,7 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
for (std::set<std::string>::const_iterator i(_imp->use_expand.begin()), i_end(_imp->use_expand.end()) ;
i != i_end ; ++i)
{
- std::string lower_i;
- std::transform(i->begin(), i->end(), std::back_inserter(lower_i), ::tolower);
-
+ std::string lower_i(tolower(*i));
std::set<std::string> values;
tokenise_whitespace(_imp->vars->get(*i), std::inserter(values, values.begin()));
for (std::set<std::string>::const_iterator v(values.begin()), v_end(values.end()) ;
diff --git a/paludis/repositories/e/e_choices_key.cc b/paludis/repositories/e/e_choices_key.cc
index c02f554..9f75658 100644
--- a/paludis/repositories/e/e_choices_key.cc
+++ b/paludis/repositories/e/e_choices_key.cc
@@ -39,6 +39,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/upper_lower.hh>
#include <paludis/environment.hh>
#include <paludis/choice.hh>
@@ -115,8 +116,7 @@ namespace
bool operator() (const std::string & s) const
{
- std::string lower_s;
- std::transform(s.begin(), s.end(), std::back_inserter(lower_s), &::tolower);
+ std::string lower_s(tolower(s));
lower_s.append(delim);
return (0 == flag.value().compare(0, lower_s.length(), lower_s, 0, lower_s.length()));
}
@@ -310,8 +310,7 @@ EChoicesKey::populate_myoptions() const
{
Context local_local_context("When using raw_use_expand_key value '" + *u + "' to populate choices:");
- std::string lower_u;
- std::transform(u->begin(), u->end(), std::back_inserter(lower_u), &::tolower);
+ std::string lower_u(tolower(*u));
std::shared_ptr<Choice> exp(std::make_shared<Choice>(make_named_values<ChoiceParams>(
n::consider_added_or_changed() = true,
n::contains_every_value() = false,
@@ -504,8 +503,7 @@ EChoicesKey::populate_iuse(const std::shared_ptr<const Map<ChoiceNameWithPrefix,
for (Set<std::string>::ConstIterator u(raw_use_expand->begin()), u_end(raw_use_expand->end()) ;
u != u_end ; ++u)
{
- std::string lower_u;
- std::transform(u->begin(), u->end(), std::back_inserter(lower_u), &::tolower);
+ std::string lower_u(tolower(*u));
std::shared_ptr<Choice> exp(std::make_shared<Choice>(make_named_values<ChoiceParams>(
n::consider_added_or_changed() = true,
n::contains_every_value() = ! _imp->id->eapi()->supported()->ebuild_options()->require_use_expand_in_iuse(),
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 3fd6154..2f7d5c2 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -68,6 +68,7 @@
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/join.hh>
+#include <paludis/util/upper_lower.hh>
#include <set>
#include <iterator>
@@ -387,9 +388,7 @@ EbuildID::need_non_xml_keys_added() const
x_end(e_repo->profile()->use_expand_implicit()->end()) ;
x != x_end ; ++x)
{
- std::string lower_x;
- std::transform(x->begin(), x->end(), std::back_inserter(lower_x), &::tolower);
-
+ std::string lower_x(tolower(*x));
bool prefixed(use_expand->end() != use_expand->find(*x));
bool unprefixed(use_expand_unprefixed->end() != use_expand_unprefixed->find(*x));
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index 9296084..333fd1f 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -42,6 +42,7 @@
#include <paludis/util/fs_path.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/env_var_names.hh>
+#include <paludis/util/upper_lower.hh>
#include <algorithm>
#include <list>
@@ -148,9 +149,7 @@ namespace
{
FSPath make_fetcher(const FSPath & d, const std::string & x)
{
- std::string lower_x;
- std::transform(x.begin(), x.end(), std::back_inserter(lower_x), &::tolower);
- return d / ("do" + lower_x);
+ return d / ("do" + tolower(x));
}
}
diff --git a/paludis/repositories/e/traditional_profile.cc b/paludis/repositories/e/traditional_profile.cc
index ba9b8f9..ad1de0b 100644
--- a/paludis/repositories/e/traditional_profile.cc
+++ b/paludis/repositories/e/traditional_profile.cc
@@ -44,6 +44,7 @@
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_error.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/upper_lower.hh>
#include <paludis/choice.hh>
#include <paludis/environment.hh>
@@ -60,7 +61,6 @@
#include <vector>
#include <strings.h>
-#include <ctype.h>
using namespace paludis;
using namespace paludis::erepository;
@@ -422,9 +422,7 @@ namespace
for (Set<std::string>::ConstIterator x(_imp->use_expand->begin()), x_end(_imp->use_expand->end()) ;
x != x_end ; ++x)
{
- std::string lower_x;
- std::transform(x->begin(), x->end(), std::back_inserter(lower_x), &::tolower);
-
+ std::string lower_x(tolower(*x));
std::list<std::string> uses;
tokenise_whitespace(_imp->environment_variables[stringify(*x)], std::back_inserter(uses));
for (std::list<std::string>::const_iterator u(uses.begin()), u_end(uses.end()) ;
@@ -440,11 +438,7 @@ namespace
for (Set<std::string>::ConstIterator x(_imp->use_expand->begin()), x_end(_imp->use_expand->end()) ;
x != x_end ; ++x)
- {
- std::string lower_x;
- std::transform(x->begin(), x->end(), std::back_inserter(lower_x), &::tolower);
- _imp->known_choice_value_names.insert(std::make_pair(lower_x, std::make_shared<Set<UnprefixedChoiceName>>()));
- }
+ _imp->known_choice_value_names.insert(std::make_pair(tolower(*x), std::make_shared<Set<UnprefixedChoiceName>>()));
for (std::set<std::pair<ChoicePrefixName, UnprefixedChoiceName> >::const_iterator u(_imp->use.begin()), u_end(_imp->use.end()) ;
u != u_end ; ++u)
@@ -932,8 +926,7 @@ TraditionalProfile::known_choice_value_names(
if (_imp->known_choice_value_names_for_separator.end() == it)
it = _imp->known_choice_value_names_for_separator.insert(std::make_pair(separator, KnownMap())).first;
- std::string lower_x;
- std::transform(choice->raw_name().begin(), choice->raw_name().end(), std::back_inserter(lower_x), &::tolower);
+ std::string lower_x(tolower(choice->raw_name()));
KnownMap::const_iterator it2(it->second.find(lower_x));
if (it->second.end() == it2)
{
diff --git a/python/paludis_python.hh b/python/paludis_python.hh
index 61bb8a8..ccf63e4 100644
--- a/python/paludis_python.hh
+++ b/python/paludis_python.hh
@@ -22,6 +22,7 @@
#include <python/mutex.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/upper_lower.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/named_value-fwd.hh>
#include <boost/python.hpp>
@@ -97,9 +98,7 @@ namespace paludis
boost::python::enum_<E_> enum_(name.c_str());
for (E_ e(static_cast<E_>(0)); e != e_last ; e = static_cast<E_>(static_cast<int>(e) + 1))
{
- const std::string e_name_low = stringify(e);
- std::string e_name_up;
- std::transform(e_name_low.begin(), e_name_low.end(), std::back_inserter(e_name_up), &::toupper);
+ std::string e_name_up(toupper(stringify(e)));
enum_.value(e_name_up.c_str(), e);
doc += "\n\t" + e_name_up;
}