]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/common/address_helper.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / common / address_helper.cc
index 8f625f8db4d1fed50f0be9ae0607668aa3636760..8774892211da2c218f7d9f62ea948f462e8d6e45 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
 /*
  * address_helper.cc
  *
@@ -6,30 +8,24 @@
  */
 
 #include <netdb.h>
+#include <regex>
 
 #include "common/address_helper.h"
-#include "boost/regex.hpp"
-
-using namespace std;
 
 // decode strings like "tcp://<host>:<port>"
 int entity_addr_from_url(entity_addr_t *addr /* out */, const char *url)
 {
-       using namespace boost;
-       using std::endl;
-
-       regex expr("(tcp|rdma)://([^:]*):([\\d]+)");
-       cmatch m;
+       std::regex expr("(tcp|rdma)://([^:]*):([\\d]+)");
+       std::cmatch m;
 
-       if (regex_match(url, m, expr)) {
+       if (std::regex_match(url, m, expr)) {
                string host(m[2].first, m[2].second);
                string port(m[3].first, m[3].second);
                addrinfo hints;
                memset(&hints, 0, sizeof(hints));
                hints.ai_family = PF_UNSPEC;
                addrinfo *res;
-               int error = getaddrinfo(host.c_str(), NULL, &hints, &res);
-               if (! error) {
+               if (!getaddrinfo(host.c_str(), nullptr, &hints, &res)) {
                        addr->set_sockaddr((sockaddr*)res->ai_addr);
                        addr->set_port(std::atoi(port.c_str()));
                        freeaddrinfo(res);