Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
AddressBook: use boost to trim whitespace
Browse files Browse the repository at this point in the history
References #512 #305
  • Loading branch information
anonimal committed Dec 20, 2016
1 parent d89deae commit e7f6c59
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/client/address_book/impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "client/address_book/impl.h"

#include <boost/algorithm/string/trim.hpp>
#include <boost/asio.hpp>

#include <array>
Expand Down Expand Up @@ -357,14 +358,8 @@ AddressBook::ValidateSubscription(std::istream& stream) {
// Skip empty / too large lines
if (line.empty() || line.size() > AddressBookSize::SubscriptionLine)
continue;
// TODO(anonimal): Boost refactor
// Clear whitespace before and after host (on the line)
line.erase(
std::remove_if(
line.begin(),
line.end(),
[](char whitespace) { return std::isspace(whitespace); }),
line.end());
// Trim whitespace before and after line
boost::trim(line);
// Parse Hostname=Base64Address from line
kovri::core::IdentityEx ident;
std::size_t pos = line.find('=');
Expand Down

0 comments on commit e7f6c59

Please sign in to comment.