]> granicus.if.org Git - graphviz/commitdiff
replace 'gvputs(… xml_string0(…))' with 'xml_escape(…)'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 3 Oct 2021 17:15:48 +0000 (10:15 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 8 Oct 2021 14:57:43 +0000 (07:57 -0700)
This is, again, a functional no-op. But it has the effect of removing dynamic
allocations and making this code thread-safe.

Related to #1868.

plugin/core/gvrender_core_svg.c

index 570bcaafb9fc7cd2d58c288054ac766111cd9527..1e94dd3032029a667cab7b5f7689ffd3b2febc8b 100644 (file)
@@ -349,7 +349,8 @@ svg_begin_anchor(GVJ_t * job, char *href, char *tooltip, char *target,
     }
     if (tooltip && tooltip[0]) {
        GVPUTS(job, " xlink:title=\"");
-       gvputs(job, xml_string0(tooltip, 1));
+       const xml_flags_t flags = {.raw = 1, .dash = 1, .nbsp = 1};
+       xml_escape(tooltip, flags, (int(*)(void*, const char*))gvputs, job);
        GVPUTS(job, "\"");
     }
     if (target && target[0]) {
@@ -478,7 +479,8 @@ static void svg_textspan(GVJ_t * job, pointf p, textspan_t * span)
         gvprintdouble(job, -p.y);
         GVPUTS(job, "\">");
     }
-    gvputs(job, xml_string0(span->str, TRUE));
+    const xml_flags_t xml_flags = {.raw = 1, .dash = 1, .nbsp = 1};
+    xml_escape(span->str, xml_flags, (int(*)(void*, const char*))gvputs, job);
     if (obj->labeledgealigned)
        GVPUTS(job, "</tspan></textPath>");
     GVPUTS(job, "</text>\n");