summaryrefslogtreecommitdiff
path: root/src/cnode/cnode-algorithm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cnode/cnode-algorithm.cpp')
-rw-r--r--src/cnode/cnode-algorithm.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cnode/cnode-algorithm.cpp b/src/cnode/cnode-algorithm.cpp
index 6638936..379fb6a 100644
--- a/src/cnode/cnode-algorithm.cpp
+++ b/src/cnode/cnode-algorithm.cpp
@@ -513,7 +513,12 @@ _diff_show_other(const CfgNode *cfg1, const CfgNode *cfg2, int level,
_diff_print_indent(cfg1, cfg2, level, pfx_diff);
if (is_value) {
// at tag value
- printf("%s %s", name.c_str(), value.c_str());
+ const char *quote = "";
+ size_t vlen = value.length();
+ if (strcspn(value.c_str(), "*}{;\011\012\013\014\015 ") < vlen) {
+ quote = "\"";
+ }
+ printf("%s %s%s%s", name.c_str(), quote, value.c_str(), quote);
} else {
// at intermediate node
printf("%s", name.c_str());