diff options
author | Chris Luke <chrisy@flirble.org> | 2017-07-05 12:57:10 -0400 |
---|---|---|
committer | Chris Luke <chrisy@flirble.org> | 2017-07-05 13:15:03 -0400 |
commit | 6c645ed01cb9f4ac02b6420841c217b49045ce13 (patch) | |
tree | d2f0ffb251ca49c8e0c5c8a0dbac67569648c29f /src/vlib/buffer.c | |
parent | 01d2b4b13ad719934e1e6999f9ed6c7c36a815ff (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/buffer.c')
-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); |