Agraph_t *g;
Agsym_t *sym;
Agsym_t *newsym;
+ char* val;
+ char* nval;
int r = 1;
g = agraphof(oldobj);
newsym = agattrsym(newobj, sym->name);
if (!newsym)
return 1;
- r = agxset(newobj, newsym, agxget(oldobj, sym));
+ val = agxget(oldobj, sym);
+ r = agxset(newobj, newsym, val);
+ /* FIX(?): Each graph has its own string cache, so a whole new refstr is possibly
+ * allocated. If the original was an html string, make sure the new one is as well.
+ * If cgraph goes to single string table, this can be removed.
+ */
+ if (aghtmlstr (val)) {
+ nval = agxget (newobj, newsym);
+ agmarkhtmlstr (nval);
+ }
}
return r;
}
Agraph_t *agopen1(Agraph_t * g);
void agstrclose(Agraph_t * g);
+ /* ref string management */
+void agmarkhtmlstr(char *s);
+
/* object set management */
Agnode_t *agfindnode_by_id(Agraph_t * g, unsigned long id);
Dtcompar_f agdictorder(Agraph_t *, Dict_t *, Dtcompar_f);
return (key->refcnt & HTML_BIT);
}
+void agmarkhtmlstr(char *s)
+{
+ refstr_t *key;
+
+ if (s == NULL)
+ return;
+ key = (refstr_t *) (s - offsetof(refstr_t, store[0]));
+ key->refcnt |= HTML_BIT;
+}
+
#ifdef DEBUG
static int refstrprint(Dict_t * dict, void *ptr, void *user)
{