From: Matthew Fernandez Date: Sun, 6 Sep 2020 16:58:18 +0000 (-0700) Subject: simplify strdup_and_subst_obj0 with agxbprint X-Git-Tag: 2.46.0~20^2^2~77^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67963b2de97af8f2ff59d07fb86b65b723f4bd5d;p=graphviz simplify strdup_and_subst_obj0 with agxbprint --- diff --git a/lib/common/labels.c b/lib/common/labels.c index e2d666ea3..7339590b0 100644 --- a/lib/common/labels.c +++ b/lib/common/labels.c @@ -355,14 +355,11 @@ static char *strdup_and_subst_obj0 (char *str, void *obj, int escBackslash) if (isEdge) { agxbput(&buf, t_str); if (has_tp) { - agxbputc(&buf, ':'); - agxbput(&buf, tp_str); + agxbprint(&buf, ":%s", tp_str); } - agxbput(&buf, e_str); - agxbput(&buf, h_str); + agxbprint(&buf, "%s%s", e_str, h_str); if (has_hp) { - agxbputc(&buf, ':'); - agxbput(&buf, hp_str); + agxbprint(&buf, ":%s", hp_str); } } break; @@ -382,8 +379,7 @@ static char *strdup_and_subst_obj0 (char *str, void *obj, int escBackslash) } /* Fall through */ default: /* leave other escape sequences unmodified, e.g. \n \l \r */ - agxbputc(&buf, '\\'); - agxbputc(&buf, c); + agxbprint(&buf, "\\%c", c); break; } } else {