mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fixing cppcheck warnings.
This commit is contained in:
parent
92a9d6db45
commit
a4155f7be8
@ -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)
|
||||
{
|
||||
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);
|
||||
memset (temp, 0, size);
|
||||
memcpy (temp, h, h->size);
|
||||
temp->size = size;
|
||||
JERRY_ASSERT (size > h->size);
|
||||
|
||||
uint8_t* new_block_p = (uint8_t*) mem_heap_alloc_block (size, MEM_HEAP_ALLOC_SHORT_TERM);
|
||||
memcpy (new_block_p, h, h->size);
|
||||
memset (new_block_p + h->size, 0, size - h->size);
|
||||
|
||||
mem_heap_free_block ((uint8_t *) h);
|
||||
h = temp;
|
||||
|
||||
h = (array_list_header *) new_block_p;
|
||||
h->size = size;
|
||||
al = (array_list) h;
|
||||
}
|
||||
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,
|
||||
const char *file_name,
|
||||
const char *function_name,
|
||||
const int line_number);
|
||||
const unsigned int line_number);
|
||||
|
||||
#ifndef LIBC_NDEBUG
|
||||
# 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 */
|
||||
const char *file_name, /**< file name */
|
||||
const char *function_name, /**< function name */
|
||||
const int line_number) /**< line number */
|
||||
const unsigned int line_number) /**< line number */
|
||||
{
|
||||
if (msg != NULL
|
||||
&& file_name != NULL
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user