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:
+1
-33
@@ -61,7 +61,7 @@ jerryx_buffered_print (uint32_t value, void *user_p)
|
||||
jerryx_print_buffer (buffer_p->data, buffer_p->index);
|
||||
buffer_p->index = 0;
|
||||
|
||||
jerryx_print_string ("\\u0000");
|
||||
jerryx_print_buffer (JERRY_ZSTR_ARG ("\\u0000"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,20 +111,6 @@ jerryx_print_value (const jerry_value_t value)
|
||||
return jerry_undefined ();
|
||||
} /* jerryx_print */
|
||||
|
||||
/**
|
||||
* Print a character to standard output, also sending it to the debugger, if connected.
|
||||
*
|
||||
* @param ch: input character
|
||||
*/
|
||||
void
|
||||
jerryx_print_byte (jerry_char_t byte)
|
||||
{
|
||||
jerry_port_print_byte (byte);
|
||||
#if JERRY_DEBUGGER
|
||||
jerry_debugger_send_output (&byte, 1);
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
} /* jerryx_print_char */
|
||||
|
||||
/**
|
||||
* Print a buffer to standard output, also sending it to the debugger, if connected.
|
||||
*
|
||||
@@ -140,24 +126,6 @@ jerryx_print_buffer (const jerry_char_t *buffer_p, jerry_size_t buffer_size)
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
} /* jerryx_print_buffer */
|
||||
|
||||
/**
|
||||
* Print a zero-terminated string to standard output, also sending it to the debugger, if connected.
|
||||
*
|
||||
* @param buffer_p: inptut string buffer
|
||||
* @param buffer_size: size of the string
|
||||
*/
|
||||
void
|
||||
jerryx_print_string (const char *str_p)
|
||||
{
|
||||
const jerry_char_t *buffer_p = (jerry_char_t *) str_p;
|
||||
jerry_size_t buffer_size = (jerry_size_t) (strlen (str_p));
|
||||
|
||||
jerry_port_print_buffer (buffer_p, buffer_size);
|
||||
#if JERRY_DEBUGGER
|
||||
jerry_debugger_send_output (buffer_p, buffer_size);
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
} /* jerryx_print_string */
|
||||
|
||||
/**
|
||||
* Print backtrace as log messages up to a specific depth.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user