summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/cli.c4
-rw-r--r--src/vlib/lex.c6
-rw-r--r--src/vlib/main.c14
-rw-r--r--src/vlib/node_funcs.h4
-rw-r--r--src/vlib/threads.c10
-rw-r--r--src/vlib/trace.c2
-rw-r--r--src/vlib/trace_funcs.h2
-rw-r--r--src/vlib/unix/cli.c36
-rw-r--r--src/vlib/unix/main.c2
-rw-r--r--src/vlib/unix/mc_socket.c12
-rw-r--r--src/vlib/unix/util.c6
11 files changed, 49 insertions, 49 deletions
diff --git a/src/vlib/cli.c b/src/vlib/cli.c
index b7c4c0030b0..dcabe8dfbaf 100644
--- a/src/vlib/cli.c
+++ b/src/vlib/cli.c
@@ -617,7 +617,7 @@ vlib_cli_dispatch_sub_commands (vlib_main_t * vm,
vec_add1 (c_error->what, 0);
ed->err = elog_string (vlib_get_elog_main (),
(char *) c_error->what);
- _vec_len (c_error->what) -= 1;
+ vec_dec_len (c_error->what, 1);
}
else
ed->err = elog_string (vlib_get_elog_main (), "OK");
@@ -1179,7 +1179,7 @@ vlib_cli_normalize_path (char *input, char **result)
/* Remove any extra space at end. */
if (l > 0 && s[l - 1] == ' ')
- _vec_len (s) -= 1;
+ vec_dec_len (s, 1);
*result = s;
return index_of_last_space;
diff --git a/src/vlib/lex.c b/src/vlib/lex.c
index 1cc8f1678d2..7facba5fe25 100644
--- a/src/vlib/lex.c
+++ b/src/vlib/lex.c
@@ -113,7 +113,7 @@ vlib_lex_get_token (vlib_lex_main_t * lm, vlib_lex_token_t * rv)
lm->lex_token_names[VLIB_LEX_word],
rv->value.as_pointer);
}
- _vec_len (lm->token_buffer) = 0;
+ vec_set_len (lm->token_buffer, 0);
/* Rescan the character which terminated the keyword/word. */
lm->current_index--;
@@ -233,7 +233,7 @@ void
vlib_lex_reset (vlib_lex_main_t * lm, u8 * input_vector)
{
if (lm->pushback_vector)
- _vec_len (lm->pushback_vector) = 0;
+ vec_set_len (lm->pushback_vector, 0);
lm->pushback_sp = -1;
lm->input_vector = input_vector;
@@ -255,7 +255,7 @@ lex_onetime_init (vlib_main_t * vm)
#undef _
vec_validate (lm->token_buffer, 127);
- _vec_len (lm->token_buffer) = 0;
+ vec_set_len (lm->token_buffer, 0);
return 0;
}
diff --git a/src/vlib/main.c b/src/vlib/main.c
index fd0c1fc5f7c..a9efe7e936d 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -81,7 +81,7 @@ vlib_frame_alloc_to_node (vlib_main_t * vm, u32 to_node_index,
{
/* Allocate from end of free list. */
f = fs->free_frames[l - 1];
- _vec_len (fs->free_frames) = l - 1;
+ vec_set_len (fs->free_frames, l - 1);
}
else
{
@@ -1458,7 +1458,7 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
if (is_main)
{
vec_resize (nm->pending_frames, 32);
- _vec_len (nm->pending_frames) = 0;
+ vec_set_len (nm->pending_frames, 0);
}
/* Mark time of main loop start. */
@@ -1584,7 +1584,7 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
for (i = 0; i < _vec_len (nm->pending_frames); i++)
cpu_time_now = dispatch_pending_node (vm, i, cpu_time_now);
/* Reset pending vector for next iteration. */
- _vec_len (nm->pending_frames) = 0;
+ vec_set_len (nm->pending_frames, 0);
if (is_main)
{
@@ -1670,7 +1670,7 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
dispatch_suspended_process (vm, di, cpu_time_now);
}
}
- _vec_len (nm->data_from_advancing_timing_wheel) = 0;
+ vec_set_len (nm->data_from_advancing_timing_wheel, 0);
}
}
vlib_increment_main_loop_counter (vm);
@@ -1946,7 +1946,7 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
CLIB_CACHE_LINE_BYTES);
vec_validate (nm->data_from_advancing_timing_wheel, 10);
- _vec_len (nm->data_from_advancing_timing_wheel) = 0;
+ vec_set_len (nm->data_from_advancing_timing_wheel, 0);
/* Create the process timing wheel */
TW (tw_timer_wheel_init) ((TWT (tw_timer_wheel) *) nm->timing_wheel,
@@ -1955,9 +1955,9 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
~0 /* max expirations per call */ );
vec_validate (vm->pending_rpc_requests, 0);
- _vec_len (vm->pending_rpc_requests) = 0;
+ vec_set_len (vm->pending_rpc_requests, 0);
vec_validate (vm->processing_rpc_requests, 0);
- _vec_len (vm->processing_rpc_requests) = 0;
+ vec_set_len (vm->processing_rpc_requests, 0);
/* Default params for the buffer allocator fault injector, if configured */
if (VLIB_BUFFER_ALLOC_FAULT_INJECTOR > 0)
diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h
index de6fd4818be..df8ec7c40e6 100644
--- a/src/vlib/node_funcs.h
+++ b/src/vlib/node_funcs.h
@@ -604,7 +604,7 @@ vlib_process_get_events (vlib_main_t * vm, uword ** data_vector)
l = _vec_len (p->pending_event_data_by_type_index[t]);
if (data_vector)
vec_add (*data_vector, p->pending_event_data_by_type_index[t], l);
- _vec_len (p->pending_event_data_by_type_index[t]) = 0;
+ vec_set_len (p->pending_event_data_by_type_index[t], 0);
et = pool_elt_at_index (p->event_type_pool, t);
@@ -628,7 +628,7 @@ vlib_process_get_events_helper (vlib_process_t * p, uword t,
l = _vec_len (p->pending_event_data_by_type_index[t]);
if (data_vector)
vec_add (*data_vector, p->pending_event_data_by_type_index[t], l);
- _vec_len (p->pending_event_data_by_type_index[t]) = 0;
+ vec_set_len (p->pending_event_data_by_type_index[t], 0);
vlib_process_maybe_free_event_type (p, t);
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 567ba62891b..36a80800a09 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -235,7 +235,7 @@ vlib_thread_init (vlib_main_t * vm)
/* Set up thread 0 */
vec_validate_aligned (vlib_worker_threads, 0, CLIB_CACHE_LINE_BYTES);
- _vec_len (vlib_worker_threads) = 1;
+ vec_set_len (vlib_worker_threads, 1);
w = vlib_worker_threads;
w->thread_mheap = clib_mem_get_heap ();
w->thread_stack = vlib_thread_stacks[0];
@@ -558,7 +558,7 @@ start_workers (vlib_main_t * vm)
vec_validate_aligned (vgm->vlib_mains, n_vlib_mains - 1,
CLIB_CACHE_LINE_BYTES);
- _vec_len (vgm->vlib_mains) = 0;
+ vec_set_len (vgm->vlib_mains, 0);
vec_add1_aligned (vgm->vlib_mains, vm, CLIB_CACHE_LINE_BYTES);
if (n_vlib_mains > 1)
@@ -640,7 +640,7 @@ start_workers (vlib_main_t * vm)
vm_clone->thread_index = worker_thread_index;
vm_clone->pending_rpc_requests = 0;
vec_validate (vm_clone->pending_rpc_requests, 0);
- _vec_len (vm_clone->pending_rpc_requests) = 0;
+ vec_set_len (vm_clone->pending_rpc_requests, 0);
clib_memset (&vm_clone->random_buffer, 0,
sizeof (vm_clone->random_buffer));
clib_spinlock_init
@@ -670,7 +670,7 @@ start_workers (vlib_main_t * vm)
/* fork the frame dispatch queue */
nm_clone->pending_frames = 0;
vec_validate (nm_clone->pending_frames, 10);
- _vec_len (nm_clone->pending_frames) = 0;
+ vec_set_len (nm_clone->pending_frames, 0);
/* fork nodes */
nm_clone->nodes = 0;
@@ -1616,7 +1616,7 @@ vlib_frame_queue_main_init (u32 node_index, u32 frame_queue_nelts)
fqm->frame_queue_nelts = frame_queue_nelts;
vec_validate (fqm->vlib_frame_queues, tm->n_vlib_mains - 1);
- _vec_len (fqm->vlib_frame_queues) = 0;
+ vec_set_len (fqm->vlib_frame_queues, 0);
for (i = 0; i < tm->n_vlib_mains; i++)
{
fq = vlib_frame_queue_alloc (frame_queue_nelts);
diff --git a/src/vlib/trace.c b/src/vlib/trace.c
index 4bbd9505b71..49b521eb886 100644
--- a/src/vlib/trace.c
+++ b/src/vlib/trace.c
@@ -272,7 +272,7 @@ trace_apply_filter (vlib_main_t * vm)
for (index = 0; index < vec_len (traces_to_remove); index++)
{
trace_index = traces_to_remove[index] - tm->trace_buffer_pool;
- _vec_len (tm->trace_buffer_pool[trace_index]) = 0;
+ vec_set_len (tm->trace_buffer_pool[trace_index], 0);
pool_put_index (tm->trace_buffer_pool, trace_index);
}
diff --git a/src/vlib/trace_funcs.h b/src/vlib/trace_funcs.h
index 9313d41eb7d..3ed4768bc7b 100644
--- a/src/vlib/trace_funcs.h
+++ b/src/vlib/trace_funcs.h
@@ -125,7 +125,7 @@ vlib_free_trace (vlib_main_t * vm, vlib_buffer_t * b)
vlib_trace_main_t *tm = &vm->trace_main;
u32 trace_index = vlib_buffer_get_trace_index (b);
vlib_validate_trace (tm, b);
- _vec_len (tm->trace_buffer_pool[trace_index]) = 0;
+ vec_set_len (tm->trace_buffer_pool[trace_index], 0);
pool_put_index (tm->trace_buffer_pool, trace_index);
}
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index c546948b536..244c8df3b90 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -1610,7 +1610,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
/* Delete the desired text from the command */
memmove (cf->current_command, cf->current_command + j, delta);
- _vec_len (cf->current_command) = delta;
+ vec_set_len (cf->current_command, delta);
/* Print the new contents */
unix_vlib_cli_output_cooked (cf, uf, cf->current_command, delta);
@@ -1635,7 +1635,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
unix_vlib_cli_output_cursor_left (cf, uf);
/* Truncate the line at the cursor */
- _vec_len (cf->current_command) = cf->cursor;
+ vec_set_len (cf->current_command, cf->cursor);
cf->search_mode = 0;
break;
@@ -1677,7 +1677,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
unix_vlib_cli_output_cooked (cf, uf, (u8 *) " ", 1);
for (; (cf->current_command + cf->cursor) > save; cf->cursor--)
unix_vlib_cli_output_cursor_left (cf, uf);
- _vec_len (cf->current_command) -= delta;
+ vec_dec_len (cf->current_command, delta);
}
}
cf->search_mode = 0;
@@ -1734,13 +1734,13 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
if (cf->excursion == vec_len (cf->command_history))
{
/* down-arrowed to last entry - want a blank line */
- _vec_len (cf->current_command) = 0;
+ vec_set_len (cf->current_command, 0);
}
else if (cf->excursion < 0)
{
/* up-arrowed over the start to the end, want a blank line */
cf->excursion = vec_len (cf->command_history);
- _vec_len (cf->current_command) = 0;
+ vec_set_len (cf->current_command, 0);
}
else
{
@@ -1753,7 +1753,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
vec_validate (cf->current_command, vec_len (prev) - 1);
clib_memcpy (cf->current_command, prev, vec_len (prev));
- _vec_len (cf->current_command) = vec_len (prev);
+ vec_set_len (cf->current_command, vec_len (prev));
unix_vlib_cli_output_cooked (cf, uf, cf->current_command,
vec_len (cf->current_command));
}
@@ -1840,7 +1840,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
cf->cursor++;
unix_vlib_cli_output_cursor_left (cf, uf);
cf->cursor--;
- _vec_len (cf->current_command)--;
+ vec_dec_len (cf->current_command, 1);
}
else if (cf->cursor > 0)
{
@@ -1848,7 +1848,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
j = vec_len (cf->current_command) - cf->cursor;
memmove (cf->current_command + cf->cursor - 1,
cf->current_command + cf->cursor, j);
- _vec_len (cf->current_command)--;
+ vec_dec_len (cf->current_command, 1);
/* redraw the rest of the line */
unix_vlib_cli_output_cursor_left (cf, uf);
@@ -1884,7 +1884,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
j = vec_len (cf->current_command) - cf->cursor - 1;
memmove (cf->current_command + cf->cursor,
cf->current_command + cf->cursor + 1, j);
- _vec_len (cf->current_command)--;
+ vec_dec_len (cf->current_command, 1);
/* redraw the rest of the line */
unix_vlib_cli_output_cooked (cf, uf,
cf->current_command + cf->cursor,
@@ -1956,7 +1956,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
vec_resize (save, vec_len (cf->current_command) - cf->cursor);
clib_memcpy (save, cf->current_command + cf->cursor,
vec_len (cf->current_command) - cf->cursor);
- _vec_len (cf->current_command) = cf->cursor;
+ vec_set_len (cf->current_command, cf->cursor);
}
else
{
@@ -1978,7 +1978,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
cf->cursor--;
j--;
}
- _vec_len (cf->current_command) = j;
+ vec_set_len (cf->current_command, j);
/* replace it with the newly expanded command */
vec_append (cf->current_command, completed);
@@ -2385,7 +2385,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
vec_validate (cf->current_command, vec_len (item) - 1);
clib_memcpy (cf->current_command, item, vec_len (item));
- _vec_len (cf->current_command) = vec_len (item);
+ vec_set_len (cf->current_command, vec_len (item));
unix_vlib_cli_output_cooked (cf, uf, cf->current_command,
vec_len (cf->current_command));
@@ -2599,7 +2599,7 @@ more:
0 /* level */ ,
8 /* max_level */ );
/* Macro processor NULL terminates the return */
- _vec_len (expanded) -= 1;
+ vec_dec_len (expanded, 1);
vec_reset_length (cf->current_command);
vec_append (cf->current_command, expanded);
vec_free (expanded);
@@ -2754,7 +2754,7 @@ unix_cli_process (vlib_main_t * vm,
}
if (data)
- _vec_len (data) = 0;
+ vec_set_len (data, 0);
}
done:
@@ -2836,7 +2836,7 @@ unix_cli_read_ready (clib_file_t * uf)
return clib_error_return_unix (0, "read");
n_read = n < 0 ? 0 : n;
- _vec_len (cf->input_vector) = l + n_read;
+ vec_set_len (cf->input_vector, l + n_read);
}
if (!(n < 0))
@@ -2918,7 +2918,7 @@ unix_cli_file_add (unix_cli_main_t * cm, char *name, int fd)
vec_free (old_name);
vlib_node_set_state (vm, n->index, VLIB_NODE_STATE_POLLING);
- _vec_len (cm->unused_cli_process_node_indices) = l - 1;
+ vec_set_len (cm->unused_cli_process_node_indices, l - 1);
}
else
{
@@ -2954,7 +2954,7 @@ unix_cli_file_add (unix_cli_main_t * cm, char *name, int fd)
cf->output_vector = 0;
cf->input_vector = 0;
vec_validate (cf->current_command, 0);
- _vec_len (cf->current_command) = 0;
+ vec_set_len (cf->current_command, 0);
vlib_start_process (vm, n->runtime_index);
@@ -3445,7 +3445,7 @@ unix_cli_exec (vlib_main_t * vm,
0 /* level */ ,
8 /* max_level */ );
/* Macro processor NULL terminates the return */
- _vec_len (expanded) -= 1;
+ vec_dec_len (expanded, 1);
vec_reset_length (sub_input.buffer);
vec_append (sub_input.buffer, expanded);
vec_free (expanded);
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index 0b73597dab3..3710d8e8b68 100644
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -316,7 +316,7 @@ startup_config_process (vlib_main_t * vm,
n = read (fd, buf + l, 4096);
if (n > 0)
{
- _vec_len (buf) = l + n;
+ vec_set_len (buf, l + n);
if (n < 4096)
break;
}
diff --git a/src/vlib/unix/mc_socket.c b/src/vlib/unix/mc_socket.c
index 9800b1e744c..1f3b4e9a8f1 100644
--- a/src/vlib/unix/mc_socket.c
+++ b/src/vlib/unix/mc_socket.c
@@ -90,7 +90,7 @@ sendmsg_helper (mc_socket_main_t * msm,
h.msg_namelen = sizeof (tx_addr[0]);
if (msm->iovecs)
- _vec_len (msm->iovecs) = 0;
+ vec_set_len (msm->iovecs, 0);
n_bytes = append_buffer_index_to_iovec (vm, buffer_index, &msm->iovecs);
ASSERT (n_bytes <= msm->mc_main.transport.max_packet_size);
@@ -177,7 +177,7 @@ recvmsg_helper (mc_socket_main_t * msm,
vec_validate (msm->rx_buffers, max_alloc - 1);
n_alloc =
vlib_buffer_alloc (vm, msm->rx_buffers + n_left, max_alloc - n_left);
- _vec_len (msm->rx_buffers) = n_left + n_alloc;
+ vec_set_len (msm->rx_buffers, n_left + n_alloc);
}
ASSERT (vec_len (msm->rx_buffers) >= n_mtu);
@@ -192,7 +192,7 @@ recvmsg_helper (mc_socket_main_t * msm,
msm->iovecs[i].iov_base = b->data;
msm->iovecs[i].iov_len = buffer_size;
}
- _vec_len (msm->iovecs) = n_mtu;
+ vec_set_len (msm->iovecs, n_mtu);
{
struct msghdr h;
@@ -237,7 +237,7 @@ recvmsg_helper (mc_socket_main_t * msm,
b->next_buffer = msm->rx_buffers[i_rx];
}
- _vec_len (msm->rx_buffers) = i_rx;
+ vec_set_len (msm->rx_buffers, i_rx);
return 0 /* no error */ ;
}
@@ -418,7 +418,7 @@ catchup_socket_read_ready (clib_file_t * uf, int is_server)
}
}
- _vec_len (c->input_vector) = l + n;
+ vec_set_len (c->input_vector, l + n);
if (is_eof && vec_len (c->input_vector) > 0)
{
@@ -426,7 +426,7 @@ catchup_socket_read_ready (clib_file_t * uf, int is_server)
{
mc_msg_catchup_request_handler (mcm, (void *) c->input_vector,
c - msm->catchups);
- _vec_len (c->input_vector) = 0;
+ vec_set_len (c->input_vector, 0);
}
else
{
diff --git a/src/vlib/unix/util.c b/src/vlib/unix/util.c
index 03aef364357..04cd6f593ac 100644
--- a/src/vlib/unix/util.c
+++ b/src/vlib/unix/util.c
@@ -86,8 +86,8 @@ foreach_directory_file (char *dir_name,
s = format (s, "%s/%s", dir_name, e->d_name);
t = format (t, "%s", e->d_name);
error = f (arg, s, t);
- _vec_len (s) = 0;
- _vec_len (t) = 0;
+ vec_set_len (s, 0);
+ vec_set_len (t, 0);
if (error)
break;
@@ -116,7 +116,7 @@ vlib_unix_recursive_mkdir (char *path)
error = clib_error_return_unix (0, "mkdir '%s'", c);
goto done;
}
- _vec_len (c)--;
+ vec_dec_len (c, 1);
}
vec_add1 (c, path[i]);
i++;