esc(c) * * Format char c suitable for printing in an error message. */
| 327 | * Format char c suitable for printing in an error message. |
| 328 | */ |
| 329 | static inline string esc(char c) { |
| 330 | char buf[12]; |
| 331 | if (static_cast<uint8_t>(c) >= 0x20 && static_cast<uint8_t>(c) <= 0x7f) { |
| 332 | snprintf(buf, sizeof buf, "'%c' (%d)", c, c); |
| 333 | } else { |
| 334 | snprintf(buf, sizeof buf, "(%d)", c); |
| 335 | } |
| 336 | return string(buf); |
| 337 | } |
| 338 | |
| 339 | static inline bool in_range(long x, long lower, long upper) { |
| 340 | return (x >= lower && x <= upper); |
no outgoing calls
no test coverage detected