49 uword li_next, li_prev;
103 index = src_node - g->
nodes;
105 memset (src_node, ~0,
sizeof (src_node[0]));
124 if (!
unformat (input,
"%d%d%d", &l->src, &l->dst, &l->distance))
127 _vec_len (links) -= 1;
143 u32 node_index = va_arg (*args,
u32);
148 s =
format (s,
"%d", node_index);
164 s = format (s,
"\n%U", format_white_space, indent + 2);
165 s = format (s,
"%U -> ", format_graph_node, g, n - g->nodes);
166 vec_foreach (l, n->next.links)
167 s = format (s,
"%U (%d), ",
168 format_graph_node, g, l->node_index,
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
memset(h->entries, 0, sizeof(h->entries[0])*entries)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define pool_validate_index(v, i)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define pool_put(P, E)
Free an object E in pool P.
void graph_del_link(graph_t *g, u32 src, u32 dst)
#define vec_free(V)
Free vector's memory (no header).
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
uword unformat_graph(unformat_input_t *input, va_list *args)
uword graph_del_node(graph_t *g, u32 src)
format_function_t * format_node
static void graph_dir_del_link(graph_dir_t *d, u32 node_index)
static uword graph_dir_add_link(graph_dir_t *d, u32 node_index, u32 distance)
u32 graph_set_link(graph_t *g, u32 src, u32 dst, u32 distance)
static graph_link_t * graph_dir_get_link_to_node(graph_dir_t *d, u32 node_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void graph_dir_free(graph_dir_t *d)
u8 * format_graph_node(u8 *s, va_list *args)
u8 * format_graph(u8 *s, va_list *args)
#define vec_foreach(var, vec)
Vector iterator.
static uword pool_elts(void *v)
Number of active elements in a pool.