MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / populatePathMapping

Function populatePathMapping

src/plugin_pathtranslator.cpp:46–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44static unsigned char pathMappingStorage[sizeof(unordered_map<string, string>)];
45
46static void populatePathMapping(const char *pathMappingStr)
47{
48 pathMapping->clear();
49
50 if (!pathMappingStr) {
51 return;
52 }
53
54 stringstream ss(pathMappingStr);
55 string token;
56
57 // Expected format: "old1:new1;old2:new2;..."
58 while (std::getline(ss, token, ';')) {
59 if (token.empty()) {
60 continue;
61 }
62 std::string::size_type colonIdx = token.find(':');
63 JASSERT(colonIdx != std::string::npos)(token).Text("Bad mapping; expect old:new");
64 string oldPath = token.substr(0, colonIdx);
65 string newPath = token.substr(colonIdx + 1);
66 JASSERT(!oldPath.empty());
67 JASSERT(!newPath.empty());
68 (*pathMapping)[oldPath] = newPath;
69 }
70}
71
72static void pathTranslator_Init()
73{

Callers 2

pathTranslator_InitFunction · 0.85
pathTranslator_RestartFunction · 0.85

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected