Fixing cppcheck warnings.
This commit is contained in:
@@ -50,12 +50,16 @@ array_list_append (array_list al, void *element)
|
|||||||
if ((h->len + 1) * h->element_size + sizeof (array_list_header) > h->size)
|
if ((h->len + 1) * h->element_size + sizeof (array_list_header) > h->size)
|
||||||
{
|
{
|
||||||
size_t size = mem_heap_recommend_allocation_size (h->size + h->element_size);
|
size_t size = mem_heap_recommend_allocation_size (h->size + h->element_size);
|
||||||
array_list_header *temp = (array_list_header *) mem_heap_alloc_block (size, MEM_HEAP_ALLOC_SHORT_TERM);
|
JERRY_ASSERT (size > h->size);
|
||||||
memset (temp, 0, size);
|
|
||||||
memcpy (temp, h, h->size);
|
uint8_t* new_block_p = (uint8_t*) mem_heap_alloc_block (size, MEM_HEAP_ALLOC_SHORT_TERM);
|
||||||
temp->size = size;
|
memcpy (new_block_p, h, h->size);
|
||||||
|
memset (new_block_p + h->size, 0, size - h->size);
|
||||||
|
|
||||||
mem_heap_free_block ((uint8_t *) h);
|
mem_heap_free_block ((uint8_t *) h);
|
||||||
h = temp;
|
|
||||||
|
h = (array_list_header *) new_block_p;
|
||||||
|
h->size = size;
|
||||||
al = (array_list) h;
|
al = (array_list) h;
|
||||||
}
|
}
|
||||||
memcpy (data (al) + (h->len * h->element_size), element, h->element_size);
|
memcpy (data (al) + (h->len * h->element_size), element, h->element_size);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ extern void __attr_noreturn___
|
|||||||
libc_fatal (const char *msg,
|
libc_fatal (const char *msg,
|
||||||
const char *file_name,
|
const char *file_name,
|
||||||
const char *function_name,
|
const char *function_name,
|
||||||
const int line_number);
|
const unsigned int line_number);
|
||||||
|
|
||||||
#ifndef LIBC_NDEBUG
|
#ifndef LIBC_NDEBUG
|
||||||
# define LIBC_ASSERT(x) do { if (__builtin_expect (!(x), 0)) { \
|
# define LIBC_ASSERT(x) do { if (__builtin_expect (!(x), 0)) { \
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void __attr_noreturn___
|
|||||||
libc_fatal (const char *msg, /**< fatal error description */
|
libc_fatal (const char *msg, /**< fatal error description */
|
||||||
const char *file_name, /**< file name */
|
const char *file_name, /**< file name */
|
||||||
const char *function_name, /**< function name */
|
const char *function_name, /**< function name */
|
||||||
const int line_number) /**< line number */
|
const unsigned int line_number) /**< line number */
|
||||||
{
|
{
|
||||||
if (msg != NULL
|
if (msg != NULL
|
||||||
&& file_name != NULL
|
&& file_name != NULL
|
||||||
|
|||||||
Reference in New Issue
Block a user