c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c
index aa523c6..46ce32b 100644
--- a/src/svm/svm_fifo.c
+++ b/src/svm/svm_fifo.c
@@ -109,7 +109,7 @@
#endif
dummy_fifo = svm_fifo_create (f->nitems);
- memset (f->data, 0xFF, f->nitems);
+ clib_memset (f->data, 0xFF, f->nitems);
vec_validate (data, f->nitems);
for (i = 0; i < vec_len (data); i++)
@@ -209,7 +209,7 @@
if (f == 0)
return 0;
- memset (f, 0, sizeof (*f));
+ clib_memset (f, 0, sizeof (*f));
f->nitems = data_size_in_bytes;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
@@ -480,7 +480,7 @@
first_copy_bytes = ((nitems - f->tail) < total_copy_bytes)
? (nitems - f->tail) : total_copy_bytes;
- clib_memcpy (&f->data[f->tail], copy_from_here, first_copy_bytes);
+ _clib_memcpy (&f->data[f->tail], copy_from_here, first_copy_bytes);
f->tail += first_copy_bytes;
f->tail = (f->tail == nitems) ? 0 : f->tail;
@@ -488,8 +488,8 @@
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (&f->data[f->tail], copy_from_here + first_copy_bytes,
- second_copy_bytes);
+ _clib_memcpy (&f->data[f->tail], copy_from_here + first_copy_bytes,
+ second_copy_bytes);
f->tail += second_copy_bytes;
f->tail = (f->tail == nitems) ? 0 : f->tail;
}
@@ -566,7 +566,8 @@
first_copy_bytes = ((nitems - normalized_offset) < total_copy_bytes)
? (nitems - normalized_offset) : total_copy_bytes;
- clib_memcpy (&f->data[normalized_offset], copy_from_here, first_copy_bytes);
+ _clib_memcpy (&f->data[normalized_offset], copy_from_here,
+ first_copy_bytes);
/* Number of bytes in second copy segment, if any */
second_copy_bytes = total_copy_bytes - first_copy_bytes;
@@ -577,8 +578,8 @@
ASSERT (normalized_offset == 0);
- clib_memcpy (&f->data[normalized_offset],
- copy_from_here + first_copy_bytes, second_copy_bytes);
+ _clib_memcpy (&f->data[normalized_offset],
+ copy_from_here + first_copy_bytes, second_copy_bytes);
}
return (0);
@@ -602,11 +603,11 @@
first_chunk = f->nitems - f->head;
ASSERT (len <= f->nitems);
if (len <= first_chunk)
- clib_memcpy (&f->data[f->head], data, len);
+ _clib_memcpy (&f->data[f->head], data, len);
else
{
- clib_memcpy (&f->data[f->head], data, first_chunk);
- clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
+ _clib_memcpy (&f->data[f->head], data, first_chunk);
+ _clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
}
}
#endif
@@ -632,7 +633,7 @@
/* Number of bytes in first copy segment */
first_copy_bytes = ((nitems - f->head) < total_copy_bytes)
? (nitems - f->head) : total_copy_bytes;
- clib_memcpy (copy_here, &f->data[f->head], first_copy_bytes);
+ _clib_memcpy (copy_here, &f->data[f->head], first_copy_bytes);
f->head += first_copy_bytes;
f->head = (f->head == nitems) ? 0 : f->head;
@@ -640,8 +641,8 @@
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (copy_here + first_copy_bytes,
- &f->data[f->head], second_copy_bytes);
+ _clib_memcpy (copy_here + first_copy_bytes,
+ &f->data[f->head], second_copy_bytes);
f->head += second_copy_bytes;
f->head = (f->head == nitems) ? 0 : f->head;
}
@@ -699,14 +700,14 @@
first_copy_bytes =
((nitems - real_head) < total_copy_bytes) ?
(nitems - real_head) : total_copy_bytes;
- clib_memcpy (copy_here, &f->data[real_head], first_copy_bytes);
+ _clib_memcpy (copy_here, &f->data[real_head], first_copy_bytes);
/* Number of bytes in second copy segment, if any */
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (copy_here + first_copy_bytes, &f->data[0],
- second_copy_bytes);
+ _clib_memcpy (copy_here + first_copy_bytes, &f->data[0],
+ second_copy_bytes);
}
}
return total_copy_bytes;