From: erg Date: Thu, 4 Nov 2010 01:09:16 +0000 (+0000) Subject: Only rely on obj->id if set; if it is needed, it is set. X-Git-Tag: LAST_LIBGRAPH~32^2~1140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5eb322d4552d3cb7a02db3f72513922109ee5196;p=graphviz Only rely on obj->id if set; if it is needed, it is set. --- diff --git a/lib/common/emit.c b/lib/common/emit.c index b7cb93164..a72f0b4a6 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -2117,23 +2117,46 @@ emit_edge_label(GVJ_t* job, textlabel_t* lbl, emit_state_t lkind, int explicit, { int flags = job->flags; emit_state_t old_emit_state; + char* newid; + char* type; if (lbl == NULL) return; + if (id) { /* non-NULL if needed */ + newid = N_NEW(strlen(id) + sizeof("-headlabel"),char); + switch (lkind) { + case EMIT_ELABEL : + type = "label"; + break; + case EMIT_HLABEL : + type = "headlabel"; + break; + case EMIT_TLABEL : + type = "taillabel"; + break; + default : + assert (0); + break; + } + sprintf (newid, "%s-%s", id, type); + } + else + newid = NULL; old_emit_state = job->obj->emit_state; job->obj->emit_state = lkind; if ((url || explicit) && !(flags & EMIT_CLUSTERS_LAST)) { map_label(job, lbl); - gvrender_begin_anchor(job, url, tooltip, target, id); + gvrender_begin_anchor(job, url, tooltip, target, newid); } emit_label(job, lkind, lbl); if (spl) emit_attachment(job, lbl, spl); if (url || explicit) { if (flags & EMIT_CLUSTERS_LAST) { map_label(job, lbl); - gvrender_begin_anchor(job, url, tooltip, target, id); + gvrender_begin_anchor(job, url, tooltip, target, newid); } gvrender_end_anchor(job); } + if (newid) free (newid); job->obj->emit_state = old_emit_state; }