Improve empty checks of ecma strings
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -831,6 +831,19 @@ ecma_string_raw_chars (const ecma_string_t *string_p, /**< ecma-string */
|
||||
return result_p;
|
||||
} /* ecma_string_raw_chars */
|
||||
|
||||
/**
|
||||
* Checks whether ecma string is empty or not
|
||||
*
|
||||
* @return true - if empty
|
||||
* false - otherwise
|
||||
*/
|
||||
bool
|
||||
ecma_string_is_empty (const ecma_string_t *str_p) /**< ecma-string */
|
||||
{
|
||||
return (ECMA_STRING_GET_CONTAINER (str_p) == ECMA_STRING_CONTAINER_MAGIC_STRING
|
||||
&& str_p->u.magic_string_id == LIT_MAGIC_STRING__EMPTY);
|
||||
} /* ecma_string_is_empty */
|
||||
|
||||
/**
|
||||
* Long path part of ecma-string to ecma-string comparison routine
|
||||
*
|
||||
|
||||
@@ -179,6 +179,7 @@ ecma_string_copy_to_utf8_buffer (const ecma_string_t *, lit_utf8_byte_t *, lit_u
|
||||
extern void ecma_string_to_utf8_bytes (const ecma_string_t *, lit_utf8_byte_t *, lit_utf8_size_t);
|
||||
extern const lit_utf8_byte_t *ecma_string_raw_chars (const ecma_string_t *, lit_utf8_size_t *, bool *);
|
||||
extern void ecma_init_ecma_string_from_uint32 (ecma_string_t *, uint32_t);
|
||||
extern bool ecma_string_is_empty (const ecma_string_t *);
|
||||
|
||||
extern bool ecma_compare_ecma_strings_equal_hashes (const ecma_string_t *, const ecma_string_t *);
|
||||
extern bool ecma_compare_ecma_strings (const ecma_string_t *, const ecma_string_t *);
|
||||
|
||||
Reference in New Issue
Block a user