Skip to content

Commit fc7d523

Browse files
committed
remove the c++ syntax, struct::xxx
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang [email protected]
1 parent eda775a commit fc7d523

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

jerry-core/ecma/base/ecma-helpers-values-collection.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ecma_new_values_collection (const ecma_value_t values_buffer[], /**< ecma-values
3838
{
3939
JERRY_ASSERT (values_buffer != NULL || values_number == 0);
4040

41-
const size_t values_in_chunk = sizeof (ecma_collection_chunk_t::data) / sizeof (ecma_value_t);
41+
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
4242

4343
ecma_collection_header_t *header_p = ecma_alloc_collection_header ();
4444

@@ -86,7 +86,7 @@ ecma_free_values_collection (ecma_collection_header_t *header_p, /**< collection
8686
{
8787
JERRY_ASSERT (header_p != NULL);
8888

89-
const size_t values_in_chunk = sizeof (ecma_collection_chunk_t::data) / sizeof (ecma_value_t);
89+
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
9090

9191
ecma_collection_chunk_t *chunk_p = ECMA_GET_POINTER (ecma_collection_chunk_t,
9292
header_p->first_chunk_cp);
@@ -128,7 +128,7 @@ ecma_append_to_values_collection (ecma_collection_header_t *header_p, /**< colle
128128
bool do_ref_if_object) /**< if the value is object value,
129129
increase reference counter of the object */
130130
{
131-
const size_t values_in_chunk = sizeof (ecma_collection_chunk_t::data) / sizeof (ecma_value_t);
131+
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
132132

133133
size_t values_number = header_p->unit_number;
134134
size_t pos_of_new_value_in_chunk = values_number % values_in_chunk;
@@ -199,7 +199,7 @@ ecma_remove_last_value_from_values_collection (ecma_collection_header_t *header_
199199
{
200200
JERRY_ASSERT (header_p != NULL && header_p->unit_number > 0);
201201

202-
const size_t values_in_chunk = sizeof (ecma_collection_chunk_t::data) / sizeof (ecma_value_t);
202+
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
203203
size_t values_number = header_p->unit_number;
204204
size_t pos_of_value_to_remove_in_chunk = (values_number - 1u) % values_in_chunk;
205205

@@ -305,7 +305,7 @@ ecma_collection_iterator_next (ecma_collection_iterator_t *iterator_p) /**< cont
305305
return false;
306306
}
307307

308-
const size_t values_in_chunk = sizeof (ecma_collection_chunk_t::data) / sizeof (ecma_value_t);
308+
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
309309

310310
if (iterator_p->current_value_p == NULL)
311311
{

jerry-core/mem/mem-heap.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ void mem_heap_valgrind_freya_mempool_request (void)
9494
*/
9595
typedef enum : uint8_t
9696
{
97-
GENERAL = 0, /**< general (may be multi-chunk) block
98-
*
99-
* Note:
100-
* As zero is used for initialization in mem_heap_init,
101-
* 0 value for the GENERAL is necessary
102-
*/
103-
ONE_CHUNKED = 1 /**< one-chunked block (See also: mem_heap_alloc_chunked_block) */
97+
MEM_BLOCK_LENGTH_TYPE_GENERAL = 0, /**< general (may be multi-chunk) block
98+
*
99+
* Note:
100+
* As zero is used for initialization in mem_heap_init,
101+
* 0 value for the MEM_BLOCK_LENGTH_TYPE_GENERAL is necessary
102+
*/
103+
MEM_BLOCK_LENGTH_TYPE_ONE_CHUNKED = 1 /**< one-chunked block (See also: mem_heap_alloc_chunked_block) */
104104
} mem_block_length_type_t;
105105

106106
/**
@@ -244,7 +244,7 @@ ssize_t mem_heap_allocated_bytes[MEM_HEAP_CHUNKS_NUM];
244244
*
245245
* The array contains one entry per heap chunk with:
246246
* - length type of corresponding block, if the chunk is at start of an allocated block;
247-
* - GENERAL length type for rest chunks.
247+
* - MEM_BLOCK_LENGTH_TYPE_GENERAL length type for rest chunks.
248248
*/
249249
mem_block_length_type_t mem_heap_length_types[MEM_HEAP_CHUNKS_NUM];
250250
#endif /* !JERRY_NDEBUG */
@@ -349,7 +349,7 @@ mem_heap_init (void)
349349
for (size_t i = 0; i < MEM_HEAP_CHUNKS_NUM; i++)
350350
{
351351
#ifndef JERRY_NDEBUG
352-
JERRY_ASSERT (mem_heap_length_types[i] == mem_block_length_type_t::GENERAL);
352+
JERRY_ASSERT (mem_heap_length_types[i] == MEM_BLOCK_LENGTH_TYPE_GENERAL);
353353
#endif /* !JERRY_NDEBUG */
354354

355355
JERRY_ASSERT (mem_heap_allocated_bytes[i] == -1);
@@ -388,7 +388,7 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size of region t
388388
mem_heap_alloc_term_t alloc_term) /**< expected allocation term */
389389
{
390390
JERRY_ASSERT (size_in_bytes != 0);
391-
JERRY_ASSERT (length_type != mem_block_length_type_t::ONE_CHUNKED
391+
JERRY_ASSERT (length_type != MEM_BLOCK_LENGTH_TYPE_ONE_CHUNKED
392392
|| size_in_bytes == mem_heap_get_chunked_block_data_size ());
393393

394394
mem_check_heap ();
@@ -490,7 +490,7 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size of region t
490490
mem_heap_mark_chunk_allocated (chunk_index, false);
491491

492492
#ifndef JERRY_NDEBUG
493-
JERRY_ASSERT (length_type == mem_block_length_type_t::GENERAL
493+
JERRY_ASSERT (length_type == MEM_BLOCK_LENGTH_TYPE_GENERAL
494494
&& mem_heap_length_types[chunk_index] == length_type);
495495
#endif /* !JERRY_NDEBUG */
496496
}
@@ -593,7 +593,7 @@ mem_heap_alloc_block (size_t size_in_bytes, /**< size of region to a
593593
else
594594
{
595595
return mem_heap_alloc_block_try_give_memory_back (size_in_bytes,
596-
mem_block_length_type_t::GENERAL,
596+
MEM_BLOCK_LENGTH_TYPE_GENERAL,
597597
alloc_term);
598598
}
599599
} /* mem_heap_alloc_block */
@@ -617,7 +617,7 @@ void*
617617
mem_heap_alloc_chunked_block (mem_heap_alloc_term_t alloc_term) /**< expected allocation term */
618618
{
619619
return mem_heap_alloc_block_try_give_memory_back (mem_heap_get_chunked_block_data_size (),
620-
mem_block_length_type_t::ONE_CHUNKED,
620+
MEM_BLOCK_LENGTH_TYPE_ONE_CHUNKED,
621621
alloc_term);
622622
} /* mem_heap_alloc_chunked_block */
623623

@@ -734,7 +734,7 @@ mem_heap_free_block (void *ptr) /**< pointer to beginning of data space of the b
734734
#endif /* MEM_HEAP_ENABLE_ALLOCATED_BYTES_ARRAY */
735735

736736
#ifndef JERRY_NDEBUG
737-
mem_heap_length_types[chunk_index] = mem_block_length_type_t::GENERAL;
737+
mem_heap_length_types[chunk_index] = MEM_BLOCK_LENGTH_TYPE_GENERAL;
738738
#endif /* !JERRY_NDEBUG */
739739

740740
mem_check_heap ();
@@ -769,7 +769,7 @@ mem_heap_get_chunked_block_start (void *ptr) /**< pointer into a block */
769769

770770
#ifndef JERRY_NDEBUG
771771
size_t chunk_index = mem_heap_get_chunk_from_address ((void*) uintptr_chunk_aligned);
772-
JERRY_ASSERT (mem_heap_length_types[chunk_index] == mem_block_length_type_t::ONE_CHUNKED);
772+
JERRY_ASSERT (mem_heap_length_types[chunk_index] == MEM_BLOCK_LENGTH_TYPE_ONE_CHUNKED);
773773
#endif /* !JERRY_NDEBUG */
774774

775775
return (void*) uintptr_chunk_aligned;
@@ -993,7 +993,7 @@ mem_check_heap (void)
993993

994994
if ((MEM_HEAP_IS_ALLOCATED_BITMAP[bitmap_item_index] & bit) != 0)
995995
{
996-
if (mem_heap_length_types[chunk_index] == mem_block_length_type_t::ONE_CHUNKED)
996+
if (mem_heap_length_types[chunk_index] == MEM_BLOCK_LENGTH_TYPE_ONE_CHUNKED)
997997
{
998998
JERRY_ASSERT ((MEM_HEAP_IS_FIRST_IN_BLOCK_BITMAP[bitmap_item_index] & bit) != 0);
999999
}

0 commit comments

Comments
 (0)