Graphviz 13.0.0~dev.20250121.0651
Loading...
Searching...
No Matches

reference-counted strings More...

Collaboration diagram for string utilities:

Functions

char * agstrdup (Agraph_t *, const char *)
 returns a pointer to a reference-counted copy of the argument string, creating one if necessary
 
char * agstrdup_html (Agraph_t *, const char *)
 
int aghtmlstr (const char *)
 
char * agstrbind (Agraph_t *g, const char *)
 
int agstrfree (Agraph_t *, const char *, bool is_html)
 
char * agstrcanon (char *, char *)
 
char * agcanonStr (char *str)
 

Detailed Description

Storage management of strings as reference-counted strings. The caller does not need to dynamically allocate storage.

All uses of cgraph strings need to be freed using agstrfree in order to correctly maintain the reference count.

agcanonStr returns a pointer to a version of the input string canonicalized for output for later re-parsing. This includes quoting special characters and keywords. It uses its own internal buffer, so the value will be lost on the next call to agcanonStr. agcanon is identical with agcanonStr except it can be used with any character string. The second argument indicates whether or not the string should be canonicalized as an HTML-like string.

Function Documentation

◆ agcanonStr()

char * agcanonStr ( char *  str)

canonicalize a string for printing. must agree with strings in scan.l Shared static buffer - unsafe.

Definition at line 249 of file write.c.

References agstrcanon(), getoutputbuffer(), NULL, and str.

Referenced by _write_canonstr(), canon(), canon(), write_plain(), and writenodeandport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ aghtmlstr()

int aghtmlstr ( const char *  s)

query if a string is an ordinary string or an HTML-like string

Definition at line 401 of file refstr.c.

References refstr_t::is_html, and NULL.

Referenced by addattr(), agcopyattr(), agcopydict(), agmakeattrs(), agstrcanon(), agxset_(), applyattrs(), applyattrs(), attrstmt(), attrstmt(), cloneAttrs(), cloneDfltAttrs(), cloneGraph(), common_init_edge(), common_init_node(), copyAttr(), copyAttr(), delete_items(), delete_items(), do_graph_label(), freeattr(), freesym(), getval(), myagxget(), setattr(), unviewsubgraphsattr(), write_port(), and writeNondefaultAttr().

Here is the caller graph for this function:

◆ agstrbind()

char * agstrbind ( Agraph_t g,
const char *  s 
)

returns a pointer to a reference-counted string if it exists, or NULL if not

Definition at line 337 of file refstr.c.

References refdict(), and refstrbind().

Referenced by aginternalmaplookup(), idmap(), and myiddisc_map().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrcanon()

char * agstrcanon ( char *  arg,
char *  buf 
)

canonicalize a string for printing. must agree with strings in scan.l Unsafe if buffer is not large enough.

Definition at line 219 of file write.c.

References _agstrcanon(), agcanonhtmlstr(), and aghtmlstr().

Referenced by agcanonStr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrdup()

char * agstrdup ( Agraph_t g,
const char *  s 
)

Definition at line 370 of file refstr.c.

References agstrdup_internal().

Referenced by addattr(), agbindrec(), aginternalmapinsert(), agmakeattrs(), agnewsym(), agxset_(), canon(), concat(), concat(), concatPort(), concatPort(), endstr(), endstr(), gvusershape_open(), idmap(), myiddisc_map(), setattr(), and write_canonstr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrdup_html()

char * agstrdup_html ( Agraph_t g,
const char *  s 
)

create an HTML-like string

Definition at line 374 of file refstr.c.

References agstrdup_internal().

Referenced by addattr(), agmakeattrs(), agnewsym(), agxset_(), cloneAttrs(), copyAttr(), endstr_html(), endstr_html(), myagxset(), myagxset(), setattr(), and toHtml().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrfree()

int agstrfree ( Agraph_t g,
const char *  s,
bool  is_html 
)
Parameters
is_htmlIs the string being freed an HTML-like string?

Definition at line 378 of file refstr.c.

References FAILURE, NULL, refstr_t::refcnt, refdict(), refstr_t::s, strdict_find(), strdict_remove(), and SUCCESS.

Referenced by agdelrec(), aginternalmapdelete(), agrecclose(), agxset_(), appendnode(), appendnode(), bindattrs(), bindattrs(), canon(), cloneAttrs(), concat(), concat(), concatPort(), concatPort(), copyAttr(), delete_items(), delete_items(), freeattr(), freesym(), freeUsershape(), idfree(), myiddisc_free(), opensubg(), opensubg(), setattr(), startgraph(), startgraph(), and write_canonstr().

Here is the call graph for this function:
Here is the caller graph for this function: