Replace vera++ with clang-format (#4518)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
This commit is contained in:
@@ -13,8 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "lit-strings.h"
|
||||
|
||||
/**
|
||||
@@ -42,16 +43,14 @@ lit_get_magic_string_ex_count (void)
|
||||
const lit_utf8_byte_t *
|
||||
lit_get_magic_string_utf8 (uint32_t id) /**< magic string id */
|
||||
{
|
||||
static const lit_utf8_byte_t * const lit_magic_strings[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
static const lit_utf8_byte_t *const lit_magic_strings[] JERRY_ATTR_CONST_DATA = {
|
||||
/** @cond doxygen_suppress */
|
||||
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)
|
||||
#define LIT_MAGIC_STRING_DEF(id, utf8_string) \
|
||||
(const lit_utf8_byte_t *) utf8_string,
|
||||
#define LIT_MAGIC_STRING_DEF(id, utf8_string) (const lit_utf8_byte_t *) utf8_string,
|
||||
#include "lit-magic-strings.inc.h"
|
||||
#undef LIT_MAGIC_STRING_DEF
|
||||
#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE
|
||||
/** @endcond */
|
||||
/** @endcond */
|
||||
};
|
||||
|
||||
JERRY_ASSERT (id < LIT_NON_INTERNAL_MAGIC_STRING__COUNT);
|
||||
@@ -67,16 +66,14 @@ lit_get_magic_string_utf8 (uint32_t id) /**< magic string id */
|
||||
lit_utf8_size_t
|
||||
lit_get_magic_string_size (uint32_t id) /**< magic string id */
|
||||
{
|
||||
static const lit_magic_size_t lit_magic_string_sizes[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
static const lit_magic_size_t lit_magic_string_sizes[] JERRY_ATTR_CONST_DATA = {
|
||||
/** @cond doxygen_suppress */
|
||||
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)
|
||||
#define LIT_MAGIC_STRING_DEF(id, utf8_string) \
|
||||
sizeof(utf8_string) - 1,
|
||||
#define LIT_MAGIC_STRING_DEF(id, utf8_string) sizeof (utf8_string) - 1,
|
||||
#include "lit-magic-strings.inc.h"
|
||||
#undef LIT_MAGIC_STRING_DEF
|
||||
#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE
|
||||
/** @endcond */
|
||||
/** @endcond */
|
||||
};
|
||||
|
||||
JERRY_ASSERT (id < LIT_NON_INTERNAL_MAGIC_STRING__COUNT);
|
||||
@@ -93,17 +90,15 @@ lit_get_magic_string_size (uint32_t id) /**< magic string id */
|
||||
static lit_magic_string_id_t
|
||||
lit_get_magic_string_size_block_start (lit_utf8_size_t size) /**< magic string size */
|
||||
{
|
||||
static const lit_magic_string_id_t lit_magic_string_size_block_starts[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
static const lit_magic_string_id_t lit_magic_string_size_block_starts[] JERRY_ATTR_CONST_DATA = {
|
||||
/** @cond doxygen_suppress */
|
||||
#define LIT_MAGIC_STRING_DEF(id, utf8_string)
|
||||
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id) \
|
||||
id,
|
||||
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id) id,
|
||||
#include "lit-magic-strings.inc.h"
|
||||
LIT_NON_INTERNAL_MAGIC_STRING__COUNT
|
||||
#undef LIT_MAGIC_STRING_DEF
|
||||
#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE
|
||||
/** @endcond */
|
||||
/** @endcond */
|
||||
};
|
||||
|
||||
JERRY_ASSERT (size <= (sizeof (lit_magic_string_size_block_starts) / sizeof (lit_magic_string_id_t)));
|
||||
@@ -139,10 +134,10 @@ lit_get_magic_string_ex_size (uint32_t id) /**< external magic string id */
|
||||
* Register external magic strings
|
||||
*/
|
||||
void
|
||||
lit_magic_strings_ex_set (const lit_utf8_byte_t * const *ex_str_items, /**< character arrays, representing
|
||||
* external magic strings' contents */
|
||||
uint32_t count, /**< number of the strings */
|
||||
const lit_utf8_size_t *ex_str_sizes) /**< sizes of the strings */
|
||||
lit_magic_strings_ex_set (const lit_utf8_byte_t *const *ex_str_items, /**< character arrays, representing
|
||||
* external magic strings' contents */
|
||||
uint32_t count, /**< number of the strings */
|
||||
const lit_utf8_size_t *ex_str_sizes) /**< sizes of the strings */
|
||||
{
|
||||
JERRY_ASSERT (ex_str_items != NULL);
|
||||
JERRY_ASSERT (count > 0);
|
||||
@@ -164,8 +159,7 @@ lit_magic_strings_ex_set (const lit_utf8_byte_t * const *ex_str_items, /**< char
|
||||
JERRY_CONTEXT (lit_magic_string_ex_sizes) = ex_str_sizes;
|
||||
|
||||
#ifndef JERRY_NDEBUG
|
||||
for (lit_magic_string_ex_id_t id = (lit_magic_string_ex_id_t) 0;
|
||||
id < JERRY_CONTEXT (lit_magic_string_ex_count);
|
||||
for (lit_magic_string_ex_id_t id = (lit_magic_string_ex_id_t) 0; id < JERRY_CONTEXT (lit_magic_string_ex_count);
|
||||
id = (lit_magic_string_ex_id_t) (id + 1))
|
||||
{
|
||||
lit_utf8_size_t string_size = JERRY_CONTEXT (lit_magic_string_ex_sizes)[id];
|
||||
@@ -178,8 +172,7 @@ lit_magic_strings_ex_set (const lit_utf8_byte_t * const *ex_str_items, /**< char
|
||||
{
|
||||
const lit_magic_string_ex_id_t prev_id = id - 1;
|
||||
const lit_utf8_size_t prev_string_size = lit_get_magic_string_ex_size (prev_id);
|
||||
JERRY_ASSERT (lit_is_valid_cesu8_string (lit_get_magic_string_ex_utf8 (id),
|
||||
string_size));
|
||||
JERRY_ASSERT (lit_is_valid_cesu8_string (lit_get_magic_string_ex_utf8 (id), string_size));
|
||||
JERRY_ASSERT (prev_string_size <= string_size);
|
||||
|
||||
if (prev_string_size == string_size)
|
||||
@@ -298,8 +291,7 @@ lit_is_ex_utf8_string_magic (const lit_utf8_byte_t *string_p, /**< utf-8 string
|
||||
{
|
||||
const uint32_t magic_string_ex_count = lit_get_magic_string_ex_count ();
|
||||
|
||||
if (magic_string_ex_count == 0
|
||||
|| string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))
|
||||
if (magic_string_ex_count == 0 || string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))
|
||||
{
|
||||
return (lit_magic_string_ex_id_t) magic_string_ex_count;
|
||||
}
|
||||
@@ -358,8 +350,7 @@ lit_is_ex_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p, /**< first u
|
||||
const uint32_t magic_string_ex_count = lit_get_magic_string_ex_count ();
|
||||
const lit_utf8_size_t total_string_size = string1_size + string2_size;
|
||||
|
||||
if (magic_string_ex_count == 0
|
||||
|| total_string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))
|
||||
if (magic_string_ex_count == 0 || total_string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))
|
||||
{
|
||||
return (lit_magic_string_ex_id_t) magic_string_ex_count;
|
||||
}
|
||||
@@ -430,7 +421,7 @@ lit_copy_magic_string_to_buffer (lit_magic_string_id_t id, /**< magic string id
|
||||
|
||||
while (magic_string_bytes_count--)
|
||||
{
|
||||
bytes_copied ++;
|
||||
bytes_copied++;
|
||||
JERRY_ASSERT (bytes_copied <= buffer_size);
|
||||
|
||||
*buf_iter_p++ = *str_iter_p++;
|
||||
|
||||
Reference in New Issue
Block a user