25 #define VAT_TAB_WIDTH 2 37 u8 *
a = va_arg (*args,
u8 *);
38 return format (s,
"%d.%d.%d.%d", a[0], a[1], a[2], a[3]);
46 u32 i, i_max_n_zero, max_n_zeros, i_first_zero, n_zeros, last_double_colon;
50 i_first_zero = i_max_n_zero;
55 if (is_zero && i_first_zero >= ARRAY_LEN (a->
as_u16))
61 if ((!is_zero && n_zeros > max_n_zeros)
64 i_max_n_zero = i_first_zero;
65 max_n_zeros = n_zeros;
71 last_double_colon = 0;
74 if (i == i_max_n_zero && max_n_zeros > 1)
78 last_double_colon = 1;
83 (last_double_colon || i == 0) ?
"" :
":",
84 clib_net_to_host_u16 (a->
as_u16[i]));
85 last_double_colon = 0;
130 #define P(fmt,...) fformat(ctx->ofp, fmt, ##__VA_ARGS__) 131 #define PL(fmt,...) fformat(ctx->ofp, fmt"\n", ##__VA_ARGS__) 132 #define PPL(fmt,...) vat_json_indent_line(ctx, fmt"\n", ##__VA_ARGS__) 133 #define PP(fmt,...) vat_json_indent_line(ctx, fmt, ##__VA_ARGS__) 134 #define INCR (ctx->indent++) 135 #define DECR (ctx->indent--) 155 for (i = 0; i <
count; i++)
158 PP (
"\"%s\": ", pair->
name);
184 for (i = 0; i <
count; i++)
218 P (
"%d", node->
sint);
221 P (
"%" PRIu64, node->
uint);
224 P (
"%f", node->
real);
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
#define vec_free(V)
Free vector's memory (no header).
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_foreach(var, vec)
Vector iterator.
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".