Skip to content

Commit

Permalink
Don't use std::endl if you don't want to flush
Browse files Browse the repository at this point in the history
  • Loading branch information
peadar committed Dec 18, 2024
1 parent 7c200ac commit 4f23fb0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pstack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pstack(Procman::Process &proc)
os << "\n";
for (auto &s : threadStacks) {
proc.dumpStackText(os, s);
os << std::endl;
os << "\n";
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions python.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ printTupleVars(const PythonPrinter<PyV> *pc, Elf::Addr namesAddr, Elf::Addr valu
pc->proc.io->readObj(namesAddr + offsetof(PyTupleObject, ob_item), &varnames[0], maxvals);
pc->proc.io->readObj(valuesAddr, &varvals[0], maxvals);

pc->os << pc->prefix() << type <<":" << std::endl;
pc->os << pc->prefix() << type <<":\n";
pc->depth++;
for (auto i = 0; i < maxvals; ++i) {
pc->os << pc->prefix();
Expand Down Expand Up @@ -206,7 +206,7 @@ template <int PyV> class FramePrinter final : public PythonTypePrinter<PyV> {
if (pc->proc.context.options.doargs)
printArguments<PyV>(pc, pyo, remoteAddr);

pc->os << " in " << file << ":" << lineNo << std::endl;
pc->os << " in " << file << ":" << lineNo << "\n";

if (pc->proc.context.options.dolocals) {

Expand All @@ -228,7 +228,7 @@ template <int PyV> class FramePrinter final : public PythonTypePrinter<PyV> {

if (pc->proc.context.options.dolocals && pfo->f_locals != 0) {
pc->depth++;
pc->os << pc->prefix() << "locals: " << std::endl;
pc->os << pc->prefix() << "locals:\n";
pc->print(Elf::Addr(pfo->f_locals));
pc->depth--;
}
Expand Down Expand Up @@ -322,7 +322,7 @@ template <int PyV>
void
PythonPrinter<PyV>::print(Elf::Addr remoteAddr) const {
if (depth > 10000) {
os << "too deep" << std::endl;
os << "too deep\n";
return;
}
depth++;
Expand Down Expand Up @@ -355,7 +355,7 @@ PythonPrinter<PyV>::print(Elf::Addr remoteAddr) const {
static HeapPrinter<PyV> heapPrinter;
printer = &heapPrinter;
} else {
os << remoteAddr << " unprintable-type-" << tn << "@"<< pyObjtype<PyV>(&baseObj) << std::endl;
os << remoteAddr << " unprintable-type-" << tn << "@"<< pyObjtype<PyV>(&baseObj) << "\n";
break;
}
}
Expand Down Expand Up @@ -434,13 +434,13 @@ PythonPrinter<PyV>::printInterp(Elf::Addr ptr, bool showModules)
};
State state;
proc.io->readObj(ptr, &state);
os << "---- interpreter @" << std::hex << ptr << std::dec << " -----" << std::endl ;
os << "---- interpreter @" << std::hex << ptr << std::dec << " -----\n";
for (Elf::Addr tsp = state.head; tsp; ) {
tsp = printThread(tsp);
os << std::endl;
os << "\n";
}
if (showModules) {
os << "---- modules:" << std::endl;
os << "---- modules:\n";
print(state.modules);
}
return state.next;
Expand Down

0 comments on commit 4f23fb0

Please sign in to comment.