Skip to content

Commit 28345fb

Browse files
committed
Get rid of C++ extension warning
1 parent 1f48261 commit 28345fb

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

CCDB/include/CCDB/CcdbApi.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,6 @@ class CcdbApi //: public DatabaseInterface
576576
// convert type_info to TClass, throw on failure
577577
static TClass* tinfo2TClass(std::type_info const& tinfo);
578578

579-
// split string on delimiters and return tokens as vector
580-
std::vector<std::string> splitString(const std::string& str, const char* delimiters);
581-
582579
typedef size_t (*CurlWriteCallback)(void*, size_t, size_t, void*);
583580

584581
void initCurlOptionsForRetrieve(CURL* curlHandle, void* pointer, CurlWriteCallback writeCallback, bool followRedirect = true) const;

CCDB/src/CcdbApi.cxx

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "Framework/DataTakingContext.h"
2525
#include <chrono>
2626
#include <memory>
27+
#include <ranges>
2728
#include <sstream>
2829
#include <TFile.h>
2930
#include <TGrid.h>
@@ -1665,22 +1666,13 @@ int CcdbApi::updateMetadata(std::string const& path, std::map<std::string, std::
16651666
return ret;
16661667
}
16671668

1668-
std::vector<std::string> CcdbApi::splitString(const std::string& str, const char* delimiters)
1669-
{
1670-
std::vector<std::string> tokens;
1671-
char stringForStrTok[str.length() + 1];
1672-
strcpy(stringForStrTok, str.c_str());
1673-
char* token = strtok(stringForStrTok, delimiters);
1674-
while (token != nullptr) {
1675-
tokens.emplace_back(token);
1676-
token = strtok(nullptr, delimiters);
1677-
}
1678-
return tokens;
1679-
}
1680-
16811669
void CcdbApi::initHostsPool(std::string hosts)
16821670
{
1683-
hostsPool = splitString(hosts, ",;");
1671+
hostsPool.clear();
1672+
auto splitted = hosts | std::views::transform([](char c) { return (c == ';') ? ',' : c; }) | std::views::split(',');
1673+
for (auto&& part : splitted) {
1674+
hostsPool.emplace_back(part.begin(), part.end());
1675+
}
16841676
}
16851677

16861678
std::string CcdbApi::getHostUrl(int hostIndex) const

0 commit comments

Comments
 (0)