Fix alignment: part 2

This commit is contained in:
Ilmir Usmanov
2014-10-14 14:26:52 +04:00
parent c4ba033970
commit 053cbc769f
10 changed files with 9 additions and 17 deletions
-1
View File
@@ -45,7 +45,6 @@ typedef struct \
uint8_t size; \
uint8_t max_lens; \
} \
__packed \
NAME##_hash_table;
#define HASH_INIT(NAME, SIZE) \
+7 -5
View File
@@ -31,7 +31,7 @@ linked_list_init (size_t element_size)
{
size_t size = mem_heap_recommend_allocation_size (element_size);
linked_list list = mem_heap_alloc_block (size, MEM_HEAP_ALLOC_SHORT_TERM);
if (list == NULL)
if (list == null_list)
{
__printf ("Out of memory");
JERRY_UNREACHABLE ();
@@ -39,7 +39,7 @@ linked_list_init (size_t element_size)
__memset (list, 0, size);
linked_list_header* header = (linked_list_header *) list;
header->magic = LINKED_LIST_MAGIC;
header->prev = header->next = NULL;
header->prev = header->next = null_list;
header->block_size = (uint8_t) (size - sizeof (linked_list_header));
return list;
}
@@ -62,7 +62,7 @@ linked_list_element (linked_list list, size_t element_size, size_t element_num)
ASSERT_LIST (list);
linked_list_header *header = (linked_list_header *) list;
linked_list raw = list + sizeof (linked_list_header);
if (header->block_size <= element_size * (element_num + 1))
if (header->block_size < element_size * (element_num + 1))
{
if (header->next)
{
@@ -84,9 +84,9 @@ linked_list_set_element (linked_list list, size_t element_size, size_t element_n
ASSERT_LIST (list);
linked_list_header *header = (linked_list_header *) list;
linked_list raw = list + sizeof (linked_list_header);
if (header->block_size <= element_size * (element_num + 1))
if (header->block_size < element_size * (element_num + 1))
{
if (header->next == NULL)
if (header->next == null_list)
{
header->next = (linked_list_header *) linked_list_init (element_size);
header->next->prev = header;
@@ -122,11 +122,13 @@ linked_list_set_element (linked_list list, size_t element_size, size_t element_n
((uint64_t *) raw)[element_num] = *((uint64_t *) element);
break;
}
#ifdef __TARGET_HOST_x64
case sizeof (lp_string):
{
((lp_string *) raw)[element_num] = *((lp_string *) element);
break;
}
#endif
default:
{
__printf ("Element_size %d is not supported\n", element_size);
-2
View File
@@ -26,9 +26,7 @@ typedef struct linked_list_header
struct linked_list_header *prev;
uint8_t magic;
uint8_t block_size;
uint8_t used_size;
}
__packed
linked_list_header;
typedef uint8_t* linked_list;
-1
View File
@@ -24,7 +24,6 @@ typedef struct
ecma_char_t *str;
ecma_length_t length;
}
__packed
lp_string;
bool lp_string_equal (lp_string, lp_string);
-1
View File
@@ -78,7 +78,6 @@ typedef struct \
DATA_TYPE current; \
DATA_TYPE block_len; \
} \
__packed \
NAME##_stack;
#define STACK_INIT(NAME) \
-2
View File
@@ -26,9 +26,7 @@ typedef struct tree_header
linked_list children;
uint8_t magic;
uint8_t children_num;
uint16_t reserved;
}
__packed
tree_header;
#endif /* TREE_H */
-1
View File
@@ -143,7 +143,6 @@ typedef struct
token_type type;
uint8_t uid;
}
__packed
token;
void lexer_init (const char *, size_t, bool);
+1 -1
View File
@@ -40,12 +40,12 @@ rewritable_opcode_type;
typedef struct
{
uint8_t args_count;
union
{
void (*fun1) (idx_t);
}
funs;
uint8_t args_count;
}
intrinsic_dumper;
+1 -2
View File
@@ -22,12 +22,11 @@
typedef struct
{
linked_list opcodes;
tree_header t;
linked_list opcodes;
opcode_counter_t opcodes_num;
unsigned strict_mode:1;
}
__packed
scopes_tree_int;
typedef scopes_tree_int * scopes_tree;
-1
View File
@@ -42,7 +42,6 @@ struct
uint8_t nums_count;
opcode_counter_t opcodes_count;
}
__packed
bytecode_data;
scopes_tree current_scope;