diff options
author | Chris Luke <chrisy@flirble.org> | 2017-07-05 12:57:10 -0400 |
---|---|---|
committer | Chris Luke <chris_luke@comcast.com> | 2017-07-05 17:23:41 +0000 |
commit | 7447d07719bb4c9c58501d78aa4a453d6a044863 (patch) | |
tree | b2aa30a1c865b228438a4c0f79870a75d27f92a2 /src/vlib | |
parent | 99a0e60eb6f6acd7eabd5a4cb7ded1e0419ccd54 (diff) |
Buffer name inconsistently used a cstring/vec (VPP-901)
Spotted in the output of CLI command "show buffers", the name field
sometimes had trailing garbage, the hall sign of a string not being
terminated. In this case it was being inconsistently used as a cstring
or a vec.
- CLI printf needs %v to print the vec srring
- vlib_buffer_create_free_list_helper tried to use
clib_mem_is_heap_object() to detect a vec object, wheras it should
use clib_mem_is_vec()
Change-Id: Ib8b242a0c5a18924b8af7e8e1432784eebcf572c
Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/buffer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c index be3b41efd4c..e50064ae622 100644 --- a/src/vlib/buffer.c +++ b/src/vlib/buffer.c @@ -383,7 +383,7 @@ vlib_buffer_create_free_list_helper (vlib_main_t * vm, f->index = f - bm->buffer_free_list_pool; f->n_data_bytes = vlib_buffer_round_size (n_data_bytes); f->min_n_buffers_each_physmem_alloc = VLIB_FRAME_SIZE; - f->name = clib_mem_is_heap_object (name) ? name : format (0, "%s", name); + f->name = clib_mem_is_vec (name) ? name : format (0, "%s", name); /* Setup free buffer template. */ f->buffer_init_template.free_list_index = f->index; @@ -774,7 +774,7 @@ vlib_packet_template_init (vlib_main_t * vm, { vlib_buffer_main_t *bm = vm->buffer_main; va_list va; - __attribute__ ((unused)) u8 *name; + u8 *name; vlib_buffer_free_list_t *fl; va_start (va, fmt); @@ -962,7 +962,7 @@ format_vlib_buffer_free_list (u8 * s, va_list * va) bytes_alloc = size * f->n_alloc; bytes_free = size * n_free; - s = format (s, "%7d%30s%12d%12d%=12U%=12U%=12d%=12d", threadnum, + s = format (s, "%7d%30v%12d%12d%=12U%=12U%=12d%=12d", threadnum, f->name, f->index, f->n_data_bytes, format_memory_size, bytes_alloc, format_memory_size, bytes_free, f->n_alloc, n_free); |