mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 01:21:36 +08:00
matrix: use stack allocation for debug output string
This commit is contained in:
@@ -367,10 +367,9 @@ public:
|
|||||||
{
|
{
|
||||||
// element: tab, point, 8 digits, 4 scientific notation chars; row: newline; string: \0 end
|
// element: tab, point, 8 digits, 4 scientific notation chars; row: newline; string: \0 end
|
||||||
static const size_t n = 15 * N * M + M + 1;
|
static const size_t n = 15 * N * M + M + 1;
|
||||||
char *buf = new char[n];
|
char string[n];
|
||||||
write_string(buf, n);
|
write_string(string, n);
|
||||||
printf("%s\n", buf);
|
printf("%s\n", string);
|
||||||
delete[] buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix<Type, N, M> transpose() const
|
Matrix<Type, N, M> transpose() const
|
||||||
@@ -817,11 +816,9 @@ OStream &operator<<(OStream &os, const matrix::Matrix<Type, M, N> &matrix)
|
|||||||
os << "\n";
|
os << "\n";
|
||||||
// element: tab, point, 8 digits, 4 scientific notation chars; row: newline; string: \0 end
|
// element: tab, point, 8 digits, 4 scientific notation chars; row: newline; string: \0 end
|
||||||
static const size_t n = 15 * N * M + M + 1;
|
static const size_t n = 15 * N * M + M + 1;
|
||||||
char *buf = new char[n];
|
char string[n];
|
||||||
matrix.write_string(buf, n);
|
matrix.write_string(string, n);
|
||||||
os << buf;
|
os << string;
|
||||||
delete[] buf;
|
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,11 +161,9 @@ OStream &operator<<(OStream &os, const matrix::Vector<Type, M> &vector)
|
|||||||
os << "\n";
|
os << "\n";
|
||||||
// element: tab, point, 8 digits, 4 scientific notation chars; row: newline; string: \0 end
|
// element: tab, point, 8 digits, 4 scientific notation chars; row: newline; string: \0 end
|
||||||
static const size_t n = 15 * M * 1 + 1 + 1;
|
static const size_t n = 15 * M * 1 + 1 + 1;
|
||||||
char *buf = new char[n];
|
char string[n];
|
||||||
vector.transpose().write_string(buf, n);
|
vector.transpose().write_string(string, n);
|
||||||
os << buf;
|
os << string;
|
||||||
delete[] buf;
|
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user