diff options
Diffstat (limited to 'src/vlib/unix')
-rw-r--r-- | src/vlib/unix/cli.c | 36 | ||||
-rw-r--r-- | src/vlib/unix/main.c | 2 | ||||
-rw-r--r-- | src/vlib/unix/mc_socket.c | 12 | ||||
-rw-r--r-- | src/vlib/unix/util.c | 6 |
4 files changed, 28 insertions, 28 deletions
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++; |