Loading cmds/incident_helper/src/ih_util.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ bool getColumnIndices(std::vector<int>& indices, const char** headerNames, const size_t lastIndex = 0; int i = 0; while (headerNames[i] != NULL) { while (headerNames[i] != nullptr) { std::string s = headerNames[i]; lastIndex = line.find(s, lastIndex); if (lastIndex == std::string::npos) { Loading Loading @@ -237,18 +237,18 @@ double toDouble(const std::string& s) { Reader::Reader(const int fd) { mFile = fdopen(fd, "r"); mStatus = mFile == NULL ? "Invalid fd " + std::to_string(fd) : ""; mStatus = mFile == nullptr ? "Invalid fd " + std::to_string(fd) : ""; } Reader::~Reader() { if (mFile != NULL) fclose(mFile); if (mFile != nullptr) fclose(mFile); } bool Reader::readLine(std::string* line) { if (mFile == NULL) return false; if (mFile == nullptr) return false; char* buf = NULL; char* buf = nullptr; size_t len = 0; ssize_t read = getline(&buf, &len, mFile); if (read != -1) { Loading cmds/incident_helper/src/main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ int main(int argc, char** argv) { fprintf(stderr, "Pasring section %d...\n", sectionID); TextParserBase* parser = selectParser(sectionID); if (parser != NULL) { if (parser != nullptr) { fprintf(stderr, "Running parser: %s\n", parser->name.string()); status_t err = parser->Parse(STDIN_FILENO, STDOUT_FILENO); if (err != NO_ERROR) { Loading cmds/incident_helper/src/parsers/CpuInfoParser.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ CpuInfoParser::Parse(const int in, const int out) const nextToUsage = false; // NAME is not in the list since we need to modify the end of the CMD index. const char* headerNames[] = { "PID", "TID", "USER", "PR", "NI", "CPU", "S", "VIRT", "RES", "PCY", "CMD", NULL }; const char* headerNames[] = { "PID", "TID", "USER", "PR", "NI", "CPU", "S", "VIRT", "RES", "PCY", "CMD", nullptr }; if (!getColumnIndices(columnIndices, headerNames, line)) { return -1; } Loading cmds/incident_helper/src/parsers/PsParser.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ status_t PsParser::Parse(const int in, const int out) const { if (nline++ == 0) { header = parseHeader(line, DEFAULT_WHITESPACE); const char* headerNames[] = { "LABEL", "USER", "PID", "TID", "PPID", "VSZ", "RSS", "WCHAN", "ADDR", "S", "PRI", "NI", "RTPRIO", "SCH", "PCY", "TIME", "CMD", NULL }; const char* headerNames[] = { "LABEL", "USER", "PID", "TID", "PPID", "VSZ", "RSS", "WCHAN", "ADDR", "S", "PRI", "NI", "RTPRIO", "SCH", "PCY", "TIME", "CMD", nullptr }; if (!getColumnIndices(columnIndices, headerNames, line)) { return -1; } Loading Loading
cmds/incident_helper/src/ih_util.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ bool getColumnIndices(std::vector<int>& indices, const char** headerNames, const size_t lastIndex = 0; int i = 0; while (headerNames[i] != NULL) { while (headerNames[i] != nullptr) { std::string s = headerNames[i]; lastIndex = line.find(s, lastIndex); if (lastIndex == std::string::npos) { Loading Loading @@ -237,18 +237,18 @@ double toDouble(const std::string& s) { Reader::Reader(const int fd) { mFile = fdopen(fd, "r"); mStatus = mFile == NULL ? "Invalid fd " + std::to_string(fd) : ""; mStatus = mFile == nullptr ? "Invalid fd " + std::to_string(fd) : ""; } Reader::~Reader() { if (mFile != NULL) fclose(mFile); if (mFile != nullptr) fclose(mFile); } bool Reader::readLine(std::string* line) { if (mFile == NULL) return false; if (mFile == nullptr) return false; char* buf = NULL; char* buf = nullptr; size_t len = 0; ssize_t read = getline(&buf, &len, mFile); if (read != -1) { Loading
cmds/incident_helper/src/main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ int main(int argc, char** argv) { fprintf(stderr, "Pasring section %d...\n", sectionID); TextParserBase* parser = selectParser(sectionID); if (parser != NULL) { if (parser != nullptr) { fprintf(stderr, "Running parser: %s\n", parser->name.string()); status_t err = parser->Parse(STDIN_FILENO, STDOUT_FILENO); if (err != NO_ERROR) { Loading
cmds/incident_helper/src/parsers/CpuInfoParser.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ CpuInfoParser::Parse(const int in, const int out) const nextToUsage = false; // NAME is not in the list since we need to modify the end of the CMD index. const char* headerNames[] = { "PID", "TID", "USER", "PR", "NI", "CPU", "S", "VIRT", "RES", "PCY", "CMD", NULL }; const char* headerNames[] = { "PID", "TID", "USER", "PR", "NI", "CPU", "S", "VIRT", "RES", "PCY", "CMD", nullptr }; if (!getColumnIndices(columnIndices, headerNames, line)) { return -1; } Loading
cmds/incident_helper/src/parsers/PsParser.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ status_t PsParser::Parse(const int in, const int out) const { if (nline++ == 0) { header = parseHeader(line, DEFAULT_WHITESPACE); const char* headerNames[] = { "LABEL", "USER", "PID", "TID", "PPID", "VSZ", "RSS", "WCHAN", "ADDR", "S", "PRI", "NI", "RTPRIO", "SCH", "PCY", "TIME", "CMD", NULL }; const char* headerNames[] = { "LABEL", "USER", "PID", "TID", "PPID", "VSZ", "RSS", "WCHAN", "ADDR", "S", "PRI", "NI", "RTPRIO", "SCH", "PCY", "TIME", "CMD", nullptr }; if (!getColumnIndices(columnIndices, headerNames, line)) { return -1; } Loading