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:
@@ -28,29 +28,11 @@ jerry_port_log (const char *message_p) /**< message */
|
||||
fputs (message_p, stderr);
|
||||
} /* jerry_port_log */
|
||||
|
||||
/**
|
||||
* Default implementation of jerry_port_print_byte. Uses 'putchar' to
|
||||
* print a single character to standard output.
|
||||
*/
|
||||
void JERRY_ATTR_WEAK
|
||||
jerry_port_print_byte (jerry_char_t byte) /**< the character to print */
|
||||
jerry_port_print_buffer (const jerry_char_t *buffer_p, jerry_size_t buffer_size)
|
||||
{
|
||||
putchar (byte);
|
||||
} /* jerry_port_print_byte */
|
||||
|
||||
/**
|
||||
* Default implementation of jerry_port_print_buffer. Uses 'jerry_port_print_byte' to
|
||||
* print characters of the input buffer.
|
||||
*/
|
||||
void JERRY_ATTR_WEAK
|
||||
jerry_port_print_buffer (const jerry_char_t *buffer_p, /**< string buffer */
|
||||
jerry_size_t buffer_size) /**< string size*/
|
||||
{
|
||||
for (jerry_size_t i = 0; i < buffer_size; i++)
|
||||
{
|
||||
jerry_port_print_byte (buffer_p[i]);
|
||||
}
|
||||
} /* jerry_port_print_byte */
|
||||
fwrite (buffer_p, 1, buffer_size, stdout);
|
||||
} /* jerry_port_print_buffer */
|
||||
|
||||
/**
|
||||
* Read a line from standard input as a zero-terminated string.
|
||||
|
||||
Reference in New Issue
Block a user