Convert a python string into a literal suitable for inclusion into C code
(s)
| 222 | |
| 223 | |
| 224 | def _c_string_literal(s): |
| 225 | """ |
| 226 | Convert a python string into a literal suitable for inclusion into C code |
| 227 | """ |
| 228 | # only these three characters are forbidden in C strings |
| 229 | s = s.replace('\\', r'\\') |
| 230 | s = s.replace('"', r'\"') |
| 231 | s = s.replace('\n', r'\n') |
| 232 | return '"{}"'.format(s) |
| 233 | |
| 234 | |
| 235 | def libpaths(paths, bits): |
no test coverage detected