Graphviz 13.0.0~dev.20250121.0651
|
API: cgraph.h, cghdr.h. More...
#include <assert.h>
#include <cgraph/cghdr.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <util/alloc.h>
#include <util/unreachable.h>
Go to the source code of this file.
Data Structures | |
struct | refstr_t |
struct | strdict_t |
a string dictionary More... | |
Functions | |
static bool | refstr_eq (const char *a, bool is_html, const refstr_t *b) |
static uint64_t | hash (const void *key, size_t len, uint8_t extra) |
static strdict_t * | strdict_new (void) |
create a new string dictionary | |
static size_t | strdict_hash (const char *s, bool is_html) |
static void | strdict_add (strdict_t *dict, refstr_t *r) |
add a reference-counted string to a dictionary | |
static refstr_t * | strdict_find (strdict_t *dict, const char *s, bool is_html) |
static void | strdict_remove (strdict_t *dict, const refstr_t *key) |
remove a reference-counted string from a dictionary | |
static void | strdict_free (strdict_t **dict) |
destroy a string dictionary | |
static strdict_t ** | refdict (Agraph_t *g) |
int | agstrclose (Agraph_t *g) |
static char * | refstrbind (strdict_t *strdict, const char *s) |
char * | agstrbind (Agraph_t *g, const char *s) |
static char * | agstrdup_internal (Agraph_t *g, const char *s, bool is_html) |
char * | agstrdup (Agraph_t *g, const char *s) |
returns a pointer to a reference-counted copy of the argument string, creating one if necessary | |
char * | agstrdup_html (Agraph_t *g, const char *s) |
int | agstrfree (Agraph_t *g, const char *s, bool is_html) |
int | aghtmlstr (const char *s) |
Variables | |
static strdict_t * | Refdict_default |
static refstr_t *const | TOMBSTONE = (refstr_t *)-1 |
int agstrclose | ( | Agraph_t * | g | ) |
Definition at line 322 of file refstr.c.
References refdict(), and strdict_free().
Referenced by agclose().
|
static |
Definition at line 342 of file refstr.c.
References gv_calloc(), refstr_t::is_html, malloc(), NULL, refstr_t::refcnt, refdict(), refstr_t::s, strdict_add(), and strdict_find().
Referenced by agstrdup(), and agstrdup_html().
|
static |
derive a hash value from the given data
key | Start of data to read |
len | Number of bytes to read |
extra | An extra byte to include in the hash |
Definition at line 68 of file refstr.c.
References len(), NULL, and seed.
Definition at line 309 of file refstr.c.
References Agraph_s::clos, NULL, Refdict_default, Agclos_s::strdict, and strdict_new().
Referenced by agstrbind(), agstrclose(), agstrdup_internal(), and agstrfree().
|
static |
compare a string to a reference-counted string for equality
a | Content of the first string |
is_html | Whether the first string was an HTML-like string |
b | The second reference-counted string |
Definition at line 46 of file refstr.c.
References refstr_t::is_html, and refstr_t::s.
Referenced by strdict_find(), and strdict_remove().
|
static |
Definition at line 328 of file refstr.c.
References NULL, refstr_t::s, and strdict_find().
Referenced by agstrbind().
Definition at line 161 of file refstr.c.
References strdict_t::buckets, strdict_t::capacity_exp, free(), gv_calloc(), refstr_t::is_html, NULL, refstr_t::s, strdict_t::size, strdict_add(), strdict_hash(), TOMBSTONE, and UNREACHABLE.
Referenced by agstrdup_internal(), and strdict_add().
lookup a reference-counted string in a dictionary
dict | String dictionary to search |
s | String content to search for |
is_html | Is this an HTML-like string? |
Definition at line 225 of file refstr.c.
References strdict_t::buckets, strdict_t::capacity_exp, NULL, refstr_eq(), strdict_hash(), and TOMBSTONE.
Referenced by agstrdup_internal(), agstrfree(), and refstrbind().
|
static |
|
static |
derive hash for a given reference-counted string
s | The reference-counted string’s s member |
is_html | Is this an HTML-like string? |
Definition at line 151 of file refstr.c.
Referenced by strdict_add(), strdict_find(), and strdict_remove().
|
static |
Definition at line 144 of file refstr.c.
References gv_alloc().
Referenced by refdict().
Definition at line 256 of file refstr.c.
References strdict_t::buckets, strdict_t::capacity_exp, free(), refstr_t::is_html, NULL, refstr_eq(), refstr_t::s, strdict_t::size, strdict_hash(), and TOMBSTONE.
Referenced by agstrfree().
a sentinel, marking a dictionary bucket from which an element has been deleted
Definition at line 158 of file refstr.c.
Referenced by strdict_add(), strdict_find(), strdict_free(), and strdict_remove().