Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
[utils] Add FTRACE_JSAPI to ZJS_VALIDATE_ARGS_FULL
Browse files Browse the repository at this point in the history
This way, we get tracing in all JS APIs (with arguments that get
validated anyway) automatically. We'll still need to add FTRACE_JSAPI
to functions w/o arguments, and enable it per-file as desired.

Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
  • Loading branch information
grgustaf committed Sep 11, 2017
1 parent ed1a9de commit b5dc6cb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
8 changes: 0 additions & 8 deletions src/zjs_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ static inline void pkt_sent(struct net_context *context, int status,
*/
static ZJS_DECL_FUNC(socket_write)
{
FTRACE_JSAPI;
ZJS_VALIDATE_ARGS_OPTCOUNT(optcount, Z_OBJECT, Z_OPTIONAL Z_FUNCTION);

GET_SOCK_HANDLE_JS(this, handle);
Expand Down Expand Up @@ -709,7 +708,6 @@ static ZJS_DECL_FUNC(socket_address)
*/
static ZJS_DECL_FUNC(socket_set_timeout)
{
FTRACE_JSAPI;
ZJS_VALIDATE_ARGS_OPTCOUNT(optcount, Z_NUMBER, Z_OPTIONAL Z_FUNCTION);

GET_SOCK_HANDLE_JS(this, handle);
Expand Down Expand Up @@ -943,7 +941,6 @@ static ZJS_DECL_FUNC(server_address)
*/
static ZJS_DECL_FUNC(server_close)
{
FTRACE_JSAPI;
ZJS_VALIDATE_ARGS_OPTCOUNT(optcount, Z_OPTIONAL Z_FUNCTION);

GET_SERVER_HANDLE_JS(this, server_h);
Expand Down Expand Up @@ -977,7 +974,6 @@ static ZJS_DECL_FUNC(server_close)
*/
static ZJS_DECL_FUNC(server_get_connections)
{
FTRACE_JSAPI;
ZJS_VALIDATE_ARGS(Z_FUNCTION);

GET_SERVER_HANDLE_JS(this, server_h);
Expand Down Expand Up @@ -1007,8 +1003,6 @@ static ZJS_DECL_FUNC(server_get_connections)
*/
static ZJS_DECL_FUNC(server_listen)
{
FTRACE_JSAPI;

// options object, optional function
ZJS_VALIDATE_ARGS_OPTCOUNT(optcount, Z_OBJECT, Z_OPTIONAL Z_FUNCTION);

Expand Down Expand Up @@ -1106,7 +1100,6 @@ static ZJS_DECL_FUNC(server_listen)
*/
static ZJS_DECL_FUNC(net_create_server)
{
FTRACE_JSAPI;
ZJS_VALIDATE_ARGS_OPTCOUNT(optcount, Z_OPTIONAL Z_FUNCTION);

jerry_value_t server = zjs_create_object();
Expand Down Expand Up @@ -1195,7 +1188,6 @@ static void tcp_connected(struct net_context *context, int status,
*/
static ZJS_DECL_FUNC(socket_connect)
{
FTRACE_JSAPI;
ZJS_VALIDATE_ARGS(Z_OBJECT, Z_OPTIONAL Z_FUNCTION);

GET_SOCK_HANDLE_JS(this, handle);
Expand Down
1 change: 1 addition & 0 deletions src/zjs_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ int zjs_validate_args(const char *expectations[], const jerry_length_t argc,
* beyond what are specified are allowed and ignored.
*/
#define ZJS_VALIDATE_ARGS_FULL(optcount, offset, ...) \
FTRACE_JSAPI; \
int optcount = zjs_validate_args((const char *[]){ __VA_ARGS__, NULL }, \
argc - offset, argv + offset); \
if (optcount <= ZJS_INVALID_ARG) { \
Expand Down

0 comments on commit b5dc6cb

Please sign in to comment.