Refactor/fix/document the default port implementation (#2317)

- Various constructs could be expressed with simpler and/or more
  readable code.
- The jerry_port_log implementation for the debugger case was prone
  to buffer overflow error.
- Some documentation was still missing (even from
  jerryscript-port.h).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2018-05-09 11:15:45 +02:00
committed by GitHub
parent a1f71f8937
commit d6cf634239
6 changed files with 51 additions and 46 deletions
+4 -8
View File
@@ -61,20 +61,16 @@ bool jerry_port_default_is_abort_on_fail (void)
* The "abort-on-fail" behaviour is only available if the port
* implementation library is compiled without the DISABLE_EXTRA_API macro.
*/
void jerry_port_fatal (jerry_fatal_code_t code)
void jerry_port_fatal (jerry_fatal_code_t code) /**< cause of error */
{
#ifndef DISABLE_EXTRA_API
if (code != 0
&& code != ERR_OUT_OF_MEMORY
&& jerry_port_default_is_abort_on_fail ())
&& abort_on_fail)
{
abort ();
}
else
{
#endif /* !DISABLE_EXTRA_API */
exit (code);
#ifndef DISABLE_EXTRA_API
}
#endif /* !DISABLE_EXTRA_API */
exit (code);
} /* jerry_port_fatal */