c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/vlib/unix/cj.c b/src/vlib/unix/cj.c
index 7757146..7238dbf 100644
--- a/src/vlib/unix/cj.c
+++ b/src/vlib/unix/cj.c
@@ -97,7 +97,7 @@
cjm->num_records = max_pow2 (cjm->num_records);
vec_validate (cjm->records, cjm->num_records - 1);
- memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
+ clib_memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
cjm->tail = ~0;
cjm->enable = enable;
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 2fe33cc..56afbc2 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2728,7 +2728,7 @@
}
pool_get (cm->cli_file_pool, cf);
- memset (cf, 0, sizeof (*cf));
+ clib_memset (cf, 0, sizeof (*cf));
template.read_function = unix_cli_read_ready;
template.write_function = unix_cli_write_ready;
@@ -2918,7 +2918,7 @@
if (isatty (STDIN_FILENO) && um->cli_line_mode == 0)
{
/* Capture terminal resize events */
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_handler = unix_cli_resize_interrupt;
if (sigaction (SIGWINCH, &sa, 0) < 0)
clib_panic ("sigaction");
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index 2420861..45b12cd 100755
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -172,7 +172,7 @@
for (i = 1; i < 32; i++)
{
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_sigaction = (void *) unix_signal_handler;
sa.sa_flags = SA_SIGINFO;
diff --git a/src/vlib/unix/mc_socket.c b/src/vlib/unix/mc_socket.c
index 1da19a5..c820981 100644
--- a/src/vlib/unix/mc_socket.c
+++ b/src/vlib/unix/mc_socket.c
@@ -85,7 +85,7 @@
struct msghdr h;
word n_bytes, n_bytes_tx, n_retries;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
h.msg_name = tx_addr;
h.msg_namelen = sizeof (tx_addr[0]);
@@ -146,7 +146,7 @@
vlib_main_t *vm = msm->mc_main.vlib_main;
clib_error_t *error;
- memset (&tx_addr, 0, sizeof (tx_addr));
+ clib_memset (&tx_addr, 0, sizeof (tx_addr));
tx_addr.sin_family = AF_INET;
tx_addr.sin_addr.s_addr = mc_socket_peer_id_get_address (dest_peer_id);
tx_addr.sin_port = mc_socket_peer_id_get_port (dest_peer_id);
@@ -197,7 +197,7 @@
{
struct msghdr h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
if (rx_addr)
{
h.msg_name = rx_addr;
@@ -570,7 +570,7 @@
clib_file_t template = { 0 };
pool_get (msm->catchups, c);
- memset (c, 0, sizeof (c[0]));
+ clib_memset (c, 0, sizeof (c[0]));
client_len = sizeof (client_addr);
@@ -632,7 +632,7 @@
{
struct sockaddr_in a;
- memset (&a, 0, sizeof (a)); /* Warnings be gone */
+ clib_memset (&a, 0, sizeof (a)); /* Warnings be gone */
a.sin_family = PF_INET;
a.sin_addr.s_addr = INADDR_ANY;
@@ -672,7 +672,7 @@
0)
return clib_error_return_unix (0, "%s setsockopt SO_REUSEADDR", type);
- memset (&ms->tx_addr, 0, sizeof (ms->tx_addr));
+ clib_memset (&ms->tx_addr, 0, sizeof (ms->tx_addr));
ms->tx_addr.sin_family = AF_INET;
ms->tx_addr.sin_addr.s_addr =
htonl (msm->multicast_tx_ip4_address_host_byte_order);
@@ -682,7 +682,7 @@
sizeof (ms->tx_addr)) < 0)
return clib_error_return_unix (0, "%s bind", type);
- memset (&mcast_req, 0, sizeof (mcast_req));
+ clib_memset (&mcast_req, 0, sizeof (mcast_req));
mcast_req.imr_multiaddr.s_addr =
htonl (msm->multicast_tx_ip4_address_host_byte_order);
mcast_req.imr_interface.s_addr = msm->if_ip4_address_net_byte_order;
@@ -852,7 +852,7 @@
int one = 1;
pool_get (msm->catchups, c);
- memset (c, 0, sizeof (*c));
+ clib_memset (c, 0, sizeof (*c));
c->socket = socket (AF_INET, SOCK_STREAM, 0);
if (c->socket < 0)
@@ -867,7 +867,7 @@
return 0;
}
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = mc_socket_peer_id_get_address (catchup_peer_id);
addr.sin_port = mc_socket_peer_id_get_port (catchup_peer_id);