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:
@@ -24,13 +24,13 @@
|
||||
#include "jerryscript-ext/print.h"
|
||||
|
||||
void
|
||||
jerryx_repl (const char *prompt_p)
|
||||
jerryx_repl (const jerry_char_t *prompt_p, jerry_size_t prompt_size)
|
||||
{
|
||||
jerry_value_t result;
|
||||
|
||||
while (true)
|
||||
{
|
||||
jerryx_print_string (prompt_p);
|
||||
jerryx_print_buffer (prompt_p, prompt_size);
|
||||
fflush (stdout);
|
||||
|
||||
jerry_size_t length;
|
||||
@@ -38,7 +38,7 @@ jerryx_repl (const char *prompt_p)
|
||||
|
||||
if (line_p == NULL)
|
||||
{
|
||||
jerryx_print_byte ('\n');
|
||||
jerryx_print_buffer (JERRY_ZSTR_ARG ("\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ jerryx_repl (const char *prompt_p)
|
||||
goto exception;
|
||||
}
|
||||
|
||||
jerryx_print_byte ('\n');
|
||||
jerryx_print_buffer (JERRY_ZSTR_ARG ("\n"));
|
||||
|
||||
jerry_value_free (result);
|
||||
result = jerry_run_jobs ();
|
||||
|
||||
Reference in New Issue
Block a user