Introduce JERRY_ZSTR_ARG macro to avoid jerryx_print_string, jerryx_print_byte, jerry_port_print_byte, strlen (#4982)

Replace usage of jerryx_print_byte, jerryx_print_string with jerryx_print_buffer.

As we now have JERRY_ZSTR_ARG, so we can take advantage of it

With this, the jerry_port_print_byte port api won't need any more
this reduced the port api surface

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
Yonggang Luo
2024-11-26 00:28:55 +08:00
committed by GitHub
parent e4017f0b3a
commit dfa9afbf6e
15 changed files with 64 additions and 125 deletions
-10
View File
@@ -142,16 +142,6 @@ void jerry_port_context_free (void);
*/
void jerry_port_log (const char *message_p);
/**
* Print a single character to standard output.
*
* This port function is never called from jerry-core directly, it is only used by jerry-ext components to print
* information.
*
* @param byte: the byte to print.
*/
void jerry_port_print_byte (jerry_char_t byte);
/**
* Print a buffer to standard output
*
+5
View File
@@ -856,6 +856,11 @@ typedef void (*jerry_arraybuffer_free_cb_t) (jerry_arraybuffer_type_t buffer_typ
void *arraybuffer_user_p,
void *user_p);
/**
* Helper to expand string literal to [string pointer, string size] argument pair.
*/
#define JERRY_ZSTR_ARG(str) ((const jerry_char_t *) (str)), ((jerry_size_t) (sizeof (str) - 1))
/**
* @}
*/