Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/base/ecma-helpers.h (C/C++)

Code before:
#define ECMA_SET_INTERNAL_VALUE_POINTER(field, non_compressed_pointer) \
  ECMA_SET_NON_NULL_POINTER (field, non_compressed_pointer)

/**
 * Get an internal property value of pointer from specified compressed pointer.
 */
#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \
  ECMA_GET_POINTER (type, field)

#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */

/**
 * Free the cesu-8 string buffer allocated by 'ECMA_STRING_TO_UTF8_STRING'
 */
#define ECMA_FINALIZE_UTF8_STRING(utf8_ptr, /**< pointer to character buffer */ \
                                  utf8_str_size) /**< buffer size */ \
  if (utf8_ptr ## must_be_freed) \
  { \
    JERRY_ASSERT (utf8_ptr != NULL); \
    jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
  }

/**
 * Convert boolean to bitfield value.
 */
#define ECMA_CONVERT_BOOL_TO_FIELD(x) ((x) ? 1 : 0)

/* ecma-helpers-value.c */
bool ecma_is_value_direct (ecma_value_t value) __attr_const___;
bool ecma_is_value_simple (ecma_value_t value) __attr_const___;
bool ecma_is_value_empty (ecma_value_t value) __attr_const___;
bool ecma_is_value_undefined (ecma_value_t value) __attr_const___;
bool ecma_is_value_null (ecma_value_t value) __attr_const___;
bool ecma_is_value_boolean (ecma_value_t value) __attr_const___;
bool ecma_is_value_true (ecma_value_t value) __attr_const___;
bool ecma_is_value_false (ecma_value_t value) __attr_const___;
bool ecma_is_value_found (ecma_value_t value) __attr_const___;
bool ecma_is_value_array_hole (ecma_value_t value) __attr_const___;

bool ecma_is_value_integer_number (ecma_value_t value) __attr_const___;
bool ecma_are_values_integer_numbers (ecma_value_t first_value, ecma_value_t second_value) __attr_const___;
bool ecma_is_value_float_number (ecma_value_t value) __attr_const___;
bool ecma_is_value_number (ecma_value_t value) __attr_const___;
bool ecma_is_value_string (ecma_value_t value) __attr_const___;
bool ecma_is_value_object (ecma_value_t value) __attr_const___;
bool ecma_is_value_error_reference (ecma_value_t value) __attr_const___;

void ecma_check_value_type_is_spec_defined (ecma_value_t value);

ecma_value_t ecma_make_simple_value (const ecma_simple_value_t value) __attr_const___;
ecma_value_t ecma_make_boolean_value (bool boolean_value) __attr_const___;

Review comment (suggestion):
@robertsipka What about `ECMA_BOOL_TO_BITFIELD`? 
i) At least, for me, I can't understand what does it mean by `FIELD`.
ii) There is `ECMA_STRING_TO_UTF8_STRING` in same file. We can remove `CONVERT`.

Code after:
#define ECMA_SET_INTERNAL_VALUE_POINTER(field, non_compressed_pointer) \
  ECMA_SET_NON_NULL_POINTER (field, non_compressed_pointer)

/**
 * Get an internal property value of pointer from specified compressed pointer.
 */
#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \
  ECMA_GET_POINTER (type, field)

#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */

/**
 * Free the cesu-8 string buffer allocated by 'ECMA_STRING_TO_UTF8_STRING'
 */
#define ECMA_FINALIZE_UTF8_STRING(utf8_ptr, /**< pointer to character buffer */ \
                                  utf8_str_size) /**< buffer size */ \
  if (utf8_ptr ## must_be_freed) \
  { \
    JERRY_ASSERT (utf8_ptr != NULL); \
    jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
  }

/**
 * Convert boolean to bitfield value.
 */
#define ECMA_BOOL_TO_BITFIELD(x) ((x) ? 1 : 0)

/* ecma-helpers-value.c */
bool ecma_is_value_direct (ecma_value_t value) __attr_const___;
bool ecma_is_value_simple (ecma_value_t value) __attr_const___;
bool ecma_is_value_empty (ecma_value_t value) __attr_const___;
bool ecma_is_value_undefined (ecma_value_t value) __attr_const___;
bool ecma_is_value_null (ecma_value_t value) __attr_const___;
bool ecma_is_value_boolean (ecma_value_t value) __attr_const___;
bool ecma_is_value_true (ecma_value_t value) __attr_const___;
bool ecma_is_value_false (ecma_value_t value) __attr_const___;
bool ecma_is_value_found (ecma_value_t value) __attr_const___;
bool ecma_is_value_array_hole (ecma_value_t value) __attr_const___;

bool ecma_is_value_integer_number (ecma_value_t value) __attr_const___;
bool ecma_are_values_integer_numbers (ecma_value_t first_value, ecma_value_t second_value) __attr_const___;
bool ecma_is_value_float_number (ecma_value_t value) __attr_const___;
bool ecma_is_value_number (ecma_value_t value) __attr_const___;
bool ecma_is_value_string (ecma_value_t value) __attr_const___;
bool ecma_is_value_object (ecma_value_t value) __attr_const___;
bool ecma_is_value_error_reference (ecma_value_t value) __attr_const___;

void ecma_check_value_type_is_spec_defined (ecma_value_t value);

ecma_value_t ecma_make_boolean_value (bool boolean_value) __attr_const___;
ecma_value_t ecma_make_integer_value (ecma_integer_value_t integer_value) __attr_const___;