mirror of https://github.com/YosysHQ/yosys.git
cxxrtl, fmt: escape double quotes in c strings
This commit is contained in:
parent
7cfc49791f
commit
8bc4bd8a20
|
@ -612,7 +612,7 @@ std::string escape_c_string(const std::string &input)
|
|||
output.push_back('"');
|
||||
for (auto c : input) {
|
||||
if (::isprint(c)) {
|
||||
if (c == '\\')
|
||||
if (c == '\\' || c == '"')
|
||||
output.push_back('\\');
|
||||
output.push_back(c);
|
||||
} else {
|
||||
|
|
|
@ -630,7 +630,7 @@ std::string escape_cxx_string(const std::string &input)
|
|||
std::string output = "\"";
|
||||
for (auto c : input) {
|
||||
if (::isprint(c)) {
|
||||
if (c == '\\')
|
||||
if (c == '\\' || c == '"')
|
||||
output.push_back('\\');
|
||||
output.push_back(c);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue