From: Dmitry Volyntsev Date: Mon, 14 May 2018 11:10:23 +0000 (+0300) Subject: Removed the surplus arguments of exception macros. X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=2dc493a3dae8dedcc63de9b7788ed9304db93a7b;p=njs.git Removed the surplus arguments of exception macros. --- diff --git a/njs/njs_array.c b/njs/njs_array.c index 37491f7d..2df66b06 100644 --- a/njs/njs_array.c +++ b/njs/njs_array.c @@ -230,7 +230,7 @@ njs_array_constructor(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, size = (uint32_t) num; if ((double) size != num) { - njs_range_error(vm, NULL, NULL); + njs_range_error(vm, NULL); return NXT_ERROR; } @@ -379,7 +379,7 @@ njs_array_prototype_length(njs_vm_t *vm, njs_value_t *value, length = (uint32_t) num; if ((double) length != num) { - njs_range_error(vm, "Invalid array length", NULL); + njs_range_error(vm, "Invalid array length"); return NJS_ERROR; } @@ -1733,7 +1733,7 @@ njs_array_prototype_reduce(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, n = njs_array_iterator_index(array, iter); if (n == NJS_ARRAY_INVALID_INDEX) { - njs_type_error(vm, "invalid index", NULL); + njs_type_error(vm, "invalid index"); return NXT_ERROR; } @@ -1794,7 +1794,7 @@ njs_array_iterator_args(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs) return NXT_OK; } - njs_type_error(vm, "unexpected iterator arguments", NULL); + njs_type_error(vm, "unexpected iterator arguments"); return NXT_ERROR; } @@ -1868,7 +1868,7 @@ njs_array_prototype_reduce_right(njs_vm_t *vm, njs_value_t *args, n = njs_array_reduce_right_index(array, iter); if (n == NJS_ARRAY_INVALID_INDEX) { - njs_type_error(vm, "invalid index", NULL); + njs_type_error(vm, "invalid index"); return NXT_ERROR; } diff --git a/njs/njs_crypto.c b/njs/njs_crypto.c index ccb60710..0946fb22 100644 --- a/njs/njs_crypto.c +++ b/njs/njs_crypto.c @@ -158,7 +158,7 @@ njs_crypto_create_hash(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_object_value_t *hash; if (nxt_slow_path(nargs < 2 || !njs_is_string(&args[1]))) { - njs_type_error(vm, "algorithm must be a string", NULL); + njs_type_error(vm, "algorithm must be a string"); return NJS_ERROR; } @@ -208,17 +208,17 @@ njs_hash_prototype_update(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_object_value_t *hash; if (nxt_slow_path(nargs < 2 || !njs_is_string(&args[1]))) { - njs_type_error(vm, "data must be a string", NULL); + njs_type_error(vm, "data must be a string"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_object_value(&args[0]))) { - njs_type_error(vm, "'this' is not an object_value", NULL); + njs_type_error(vm, "'this' is not an object_value"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_data(&args[0].data.u.object_value->value))) { - njs_type_error(vm, "value of 'this' is not a data type", NULL); + njs_type_error(vm, "value of 'this' is not a data type"); return NJS_ERROR; } @@ -229,7 +229,7 @@ njs_hash_prototype_update(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, dgst = njs_value_data(&hash->value); if (nxt_slow_path(dgst->alg == NULL)) { - njs_error(vm, "Digest already called", NULL); + njs_error(vm, "Digest already called"); return NJS_ERROR; } @@ -254,17 +254,17 @@ njs_hash_prototype_digest(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_object_value_t *hash; if (nxt_slow_path(nargs > 1 && !njs_is_string(&args[1]))) { - njs_type_error(vm, "encoding must be a string", NULL); + njs_type_error(vm, "encoding must be a string"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_object_value(&args[0]))) { - njs_type_error(vm, "'this' is not an object_value", NULL); + njs_type_error(vm, "'this' is not an object_value"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_data(&args[0].data.u.object_value->value))) { - njs_type_error(vm, "value of 'this' is not a data type", NULL); + njs_type_error(vm, "value of 'this' is not a data type"); return NJS_ERROR; } @@ -284,7 +284,7 @@ njs_hash_prototype_digest(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, dgst = njs_value_data(&hash->value); if (nxt_slow_path(dgst->alg == NULL)) { - njs_error(vm, "Digest already called", NULL); + njs_error(vm, "Digest already called"); return NJS_ERROR; } @@ -392,12 +392,12 @@ njs_crypto_create_hmac(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_object_value_t *hmac; if (nxt_slow_path(nargs < 2 || !njs_is_string(&args[1]))) { - njs_type_error(vm, "algorithm must be a string", NULL); + njs_type_error(vm, "algorithm must be a string"); return NJS_ERROR; } if (nxt_slow_path(nargs < 3 || !njs_is_string(&args[2]))) { - njs_type_error(vm, "key must be a string", NULL); + njs_type_error(vm, "key must be a string"); return NJS_ERROR; } @@ -471,17 +471,17 @@ njs_hmac_prototype_update(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_object_value_t *hmac; if (nxt_slow_path(nargs < 2 || !njs_is_string(&args[1]))) { - njs_type_error(vm, "data must be a string", NULL); + njs_type_error(vm, "data must be a string"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_object_value(&args[0]))) { - njs_type_error(vm, "'this' is not an object_value", NULL); + njs_type_error(vm, "'this' is not an object_value"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_data(&args[0].data.u.object_value->value))) { - njs_type_error(vm, "value of 'this' is not a data type", NULL); + njs_type_error(vm, "value of 'this' is not a data type"); return NJS_ERROR; } @@ -492,7 +492,7 @@ njs_hmac_prototype_update(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, ctx = njs_value_data(&hmac->value); if (nxt_slow_path(ctx->alg == NULL)) { - njs_error(vm, "Digest already called", NULL); + njs_error(vm, "Digest already called"); return NJS_ERROR; } @@ -517,17 +517,17 @@ njs_hmac_prototype_digest(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_object_value_t *hmac; if (nxt_slow_path(nargs > 1 && !njs_is_string(&args[1]))) { - njs_type_error(vm, "encoding must be a string", NULL); + njs_type_error(vm, "encoding must be a string"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_object_value(&args[0]))) { - njs_type_error(vm, "'this' is not an object_value", NULL); + njs_type_error(vm, "'this' is not an object_value"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_data(&args[0].data.u.object_value->value))) { - njs_type_error(vm, "value of 'this' is not a data type", NULL); + njs_type_error(vm, "value of 'this' is not a data type"); return NJS_ERROR; } @@ -547,7 +547,7 @@ njs_hmac_prototype_digest(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, ctx = njs_value_data(&hmac->value); if (nxt_slow_path(ctx->alg == NULL)) { - njs_error(vm, "Digest already called", NULL); + njs_error(vm, "Digest already called"); return NJS_ERROR; } diff --git a/njs/njs_date.c b/njs/njs_date.c index d43dc967..a4a79c7c 100644 --- a/njs/njs_date.c +++ b/njs/njs_date.c @@ -1043,7 +1043,7 @@ njs_date_prototype_to_iso_string(njs_vm_t *vm, njs_value_t *args, return njs_string_new(vm, &vm->retval, buf, size, size); } - njs_range_error(vm, NULL, NULL); + njs_range_error(vm, NULL); return NXT_ERROR; } @@ -1891,7 +1891,7 @@ njs_date_prototype_to_json(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, } } - njs_type_error(vm, "'this' argument is not an object", NULL); + njs_type_error(vm, "'this' argument is not an object"); return NXT_ERROR; } diff --git a/njs/njs_error.c b/njs/njs_error.c index 34fe97d8..19fd6c5e 100644 --- a/njs/njs_error.c +++ b/njs/njs_error.c @@ -596,7 +596,7 @@ njs_error_prototype_to_string(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, static const njs_value_t default_name = njs_string("Error"); if (nargs < 1 || !njs_is_object(&args[0])) { - njs_type_error(vm, "'this' argument is not an object", NULL); + njs_type_error(vm, "'this' argument is not an object"); return NXT_ERROR; } diff --git a/njs/njs_error.h b/njs/njs_error.h index 719ecb6d..9e8b6421 100644 --- a/njs/njs_error.h +++ b/njs/njs_error.h @@ -9,21 +9,21 @@ #define njs_error(vm, fmt, ...) \ - njs_exception_error_create(vm, NJS_OBJECT_ERROR, fmt, __VA_ARGS__) + njs_exception_error_create(vm, NJS_OBJECT_ERROR, fmt, ##__VA_ARGS__) #define njs_eval_error(vm, fmt, ...) \ - njs_exception_error_create(vm, NJS_OBJECT_EVAL_ERROR, fmt, __VA_ARGS__) + njs_exception_error_create(vm, NJS_OBJECT_EVAL_ERROR, fmt, ##__VA_ARGS__) #define njs_internal_error(vm, fmt, ...) \ - njs_exception_error_create(vm, NJS_OBJECT_INTERNAL_ERROR, fmt, __VA_ARGS__) + njs_exception_error_create(vm, NJS_OBJECT_INTERNAL_ERROR, fmt, ##__VA_ARGS__) #define njs_range_error(vm, fmt, ...) \ - njs_exception_error_create(vm, NJS_OBJECT_RANGE_ERROR, fmt, __VA_ARGS__) + njs_exception_error_create(vm, NJS_OBJECT_RANGE_ERROR, fmt, ##__VA_ARGS__) #define njs_reference_error(vm, fmt, ...) \ - njs_exception_error_create(vm, NJS_OBJECT_REF_ERROR, fmt, __VA_ARGS__) + njs_exception_error_create(vm, NJS_OBJECT_REF_ERROR, fmt, ##__VA_ARGS__) #define njs_syntax_error(vm, fmt, ...) \ - njs_exception_error_create(vm, NJS_OBJECT_SYNTAX_ERROR, fmt, __VA_ARGS__) + njs_exception_error_create(vm, NJS_OBJECT_SYNTAX_ERROR, fmt, ##__VA_ARGS__) #define njs_type_error(vm, fmt, ...) \ - njs_exception_error_create(vm, NJS_OBJECT_TYPE_ERROR, fmt, __VA_ARGS__) + njs_exception_error_create(vm, NJS_OBJECT_TYPE_ERROR, fmt, ##__VA_ARGS__) #define njs_uri_error(vm, fmt, ...) \ - njs_exception_error_create(vm, NJS_OBJECT_URI_ERROR, fmt, __VA_ARGS__) + njs_exception_error_create(vm, NJS_OBJECT_URI_ERROR, fmt, ##__VA_ARGS__) void njs_exception_error_create(njs_vm_t *vm, njs_value_type_t type, const char* fmt, ...); diff --git a/njs/njs_fs.c b/njs/njs_fs.c index d1a1db33..0350d0f6 100644 --- a/njs/njs_fs.c +++ b/njs/njs_fs.c @@ -99,12 +99,12 @@ njs_fs_read_file(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, nxt_lvlhsh_query_t lhq; if (nxt_slow_path(nargs < 3)) { - njs_type_error(vm, "too few arguments", NULL); + njs_type_error(vm, "too few arguments"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_string(&args[1]))) { - njs_type_error(vm, "path must be a string", NULL); + njs_type_error(vm, "path must be a string"); return NJS_ERROR; } @@ -139,12 +139,12 @@ njs_fs_read_file(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, } else { njs_type_error(vm, "Unknown options type " - "(a string or object required)", NULL); + "(a string or object required)"); return NJS_ERROR; } if (nxt_slow_path(nargs < 4 || !njs_is_function(&args[3]))) { - njs_type_error(vm, "callback must be a function", NULL); + njs_type_error(vm, "callback must be a function"); return NJS_ERROR; } @@ -152,7 +152,7 @@ njs_fs_read_file(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, } else { if (nxt_slow_path(!njs_is_function(&args[2]))) { - njs_type_error(vm, "callback must be a function", NULL); + njs_type_error(vm, "callback must be a function"); return NJS_ERROR; } @@ -313,12 +313,12 @@ njs_fs_read_file_sync(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, nxt_lvlhsh_query_t lhq; if (nxt_slow_path(nargs < 2)) { - njs_type_error(vm, "too few arguments", NULL); + njs_type_error(vm, "too few arguments"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_string(&args[1]))) { - njs_type_error(vm, "path must be a string", NULL); + njs_type_error(vm, "path must be a string"); return NJS_ERROR; } @@ -353,7 +353,7 @@ njs_fs_read_file_sync(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, } else { njs_type_error(vm, "Unknown options type " - "(a string or object required)", NULL); + "(a string or object required)"); return NJS_ERROR; } } @@ -534,17 +534,17 @@ static njs_ret_t njs_fs_write_file_internal(njs_vm_t *vm, njs_value_t *args, nxt_lvlhsh_query_t lhq; if (nxt_slow_path(nargs < 4)) { - njs_type_error(vm, "too few arguments", NULL); + njs_type_error(vm, "too few arguments"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_string(&args[1]))) { - njs_type_error(vm, "path must be a string", NULL); + njs_type_error(vm, "path must be a string"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_string(&args[2]))) { - njs_type_error(vm, "data must be a string", NULL); + njs_type_error(vm, "data must be a string"); return NJS_ERROR; } @@ -592,12 +592,12 @@ static njs_ret_t njs_fs_write_file_internal(njs_vm_t *vm, njs_value_t *args, } else { njs_type_error(vm, "Unknown options type " - "(a string or object required)", NULL); + "(a string or object required)"); return NJS_ERROR; } if (nxt_slow_path(nargs < 5 || !njs_is_function(&args[4]))) { - njs_type_error(vm, "callback must be a function", NULL); + njs_type_error(vm, "callback must be a function"); return NJS_ERROR; } @@ -605,7 +605,7 @@ static njs_ret_t njs_fs_write_file_internal(njs_vm_t *vm, njs_value_t *args, } else { if (nxt_slow_path(!njs_is_function(&args[3]))) { - njs_type_error(vm, "callback must be a function", NULL); + njs_type_error(vm, "callback must be a function"); return NJS_ERROR; } @@ -723,17 +723,17 @@ njs_fs_write_file_sync_internal(njs_vm_t *vm, njs_value_t *args, nxt_lvlhsh_query_t lhq; if (nxt_slow_path(nargs < 3)) { - njs_type_error(vm, "too few arguments", NULL); + njs_type_error(vm, "too few arguments"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_string(&args[1]))) { - njs_type_error(vm, "path must be a string", NULL); + njs_type_error(vm, "path must be a string"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_string(&args[2]))) { - njs_type_error(vm, "data must be a string", NULL); + njs_type_error(vm, "data must be a string"); return NJS_ERROR; } @@ -781,7 +781,7 @@ njs_fs_write_file_sync_internal(njs_vm_t *vm, njs_value_t *args, } else { njs_type_error(vm, "Unknown options type " - "(a string or object required)", NULL); + "(a string or object required)"); return NJS_ERROR; } } @@ -927,7 +927,7 @@ static njs_ret_t njs_fs_error(njs_vm_t *vm, const char *syscall, ret = nxt_lvlhsh_insert(&error->hash, &lhq); if (nxt_slow_path(ret != NXT_OK)) { - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NJS_ERROR; } } @@ -946,7 +946,7 @@ static njs_ret_t njs_fs_error(njs_vm_t *vm, const char *syscall, ret = nxt_lvlhsh_insert(&error->hash, &lhq); if (nxt_slow_path(ret != NXT_OK)) { - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NJS_ERROR; } } @@ -971,7 +971,7 @@ static njs_ret_t njs_fs_error(njs_vm_t *vm, const char *syscall, ret = nxt_lvlhsh_insert(&error->hash, &lhq); if (nxt_slow_path(ret != NXT_OK)) { - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NJS_ERROR; } } diff --git a/njs/njs_function.c b/njs/njs_function.c index 67a491b5..f14788a4 100644 --- a/njs/njs_function.c +++ b/njs/njs_function.c @@ -240,7 +240,7 @@ njs_function_frame_alloc(njs_vm_t *vm, size_t size) spare_size = nxt_align_size(spare_size, NJS_FRAME_SPARE_SIZE); if (vm->stack_size + spare_size > NJS_MAX_STACK_SIZE) { - njs_range_error(vm, "Maximum call stack size exceeded", NULL); + njs_range_error(vm, "Maximum call stack size exceeded"); return NULL; } @@ -501,7 +501,7 @@ njs_function_prototype_call(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_function_t *function; if (!njs_is_function(&args[0])) { - njs_type_error(vm, "'this' argument is not a function", NULL); + njs_type_error(vm, "'this' argument is not a function"); return NXT_ERROR; } @@ -529,7 +529,7 @@ njs_function_prototype_apply(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_function_t *function; if (!njs_is_function(&args[0])) { - njs_type_error(vm, "'this' argument is not a function", NULL); + njs_type_error(vm, "'this' argument is not a function"); return NXT_ERROR; } @@ -538,7 +538,7 @@ njs_function_prototype_apply(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, if (nargs > 2) { if (!njs_is_array(&args[2])) { - njs_type_error(vm, "second argument is not an array", NULL); + njs_type_error(vm, "second argument is not an array"); return NXT_ERROR; } @@ -610,7 +610,7 @@ njs_function_prototype_bind(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_function_t *function; if (!njs_is_function(&args[0])) { - njs_type_error(vm, "'this' argument is not a function", NULL); + njs_type_error(vm, "'this' argument is not a function"); return NXT_ERROR; } @@ -689,7 +689,7 @@ njs_ret_t njs_eval_function(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_index_t unused) { - njs_internal_error(vm, "Not implemented", NULL); + njs_internal_error(vm, "Not implemented"); return NXT_ERROR; } diff --git a/njs/njs_generator.c b/njs/njs_generator.c index 689900c5..c35289fe 100644 --- a/njs/njs_generator.c +++ b/njs/njs_generator.c @@ -328,7 +328,7 @@ njs_generator(njs_vm_t *vm, njs_parser_t *parser, njs_parser_node_t *node) default: nxt_thread_log_debug("unknown token: %d", node->token); - njs_syntax_error(vm, "unknown token", NULL); + njs_syntax_error(vm, "unknown token"); return NXT_ERROR; } @@ -1137,7 +1137,7 @@ njs_generate_continue_statement(njs_vm_t *vm, njs_parser_t *parser, } } - njs_parser_syntax_error(vm, parser, "Illegal continue statement", NULL); + njs_parser_syntax_error(vm, parser, "Illegal continue statement"); return NXT_ERROR; @@ -1180,7 +1180,7 @@ njs_generate_break_statement(njs_vm_t *vm, njs_parser_t *parser, } } - njs_parser_syntax_error(vm, parser, "Illegal break statement", NULL); + njs_parser_syntax_error(vm, parser, "Illegal break statement"); return NXT_ERROR; @@ -2066,7 +2066,7 @@ njs_generate_scope(njs_vm_t *vm, njs_parser_t *parser, njs_parser_node_t *node) parser->code_size, code_size); if (nxt_slow_path(parser->code_size < code_size)) { - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NXT_ERROR; } diff --git a/njs/njs_json.c b/njs/njs_json.c index 173e5105..938110ba 100644 --- a/njs/njs_json.c +++ b/njs/njs_json.c @@ -471,7 +471,7 @@ njs_json_parse_object(njs_json_parse_ctx_t *ctx, njs_value_t *value, ret = nxt_lvlhsh_insert(&object->hash, &lhq); if (nxt_slow_path(ret != NXT_OK)) { - njs_internal_error(ctx->vm, NULL, NULL); + njs_internal_error(ctx->vm, NULL); return NULL; } @@ -566,7 +566,7 @@ njs_json_parse_array(njs_json_parse_ctx_t *ctx, njs_value_t *value, ret = njs_array_add(ctx->vm, array, element); if (nxt_slow_path(ret != NXT_OK)) { - njs_internal_error(ctx->vm, NULL, NULL); + njs_internal_error(ctx->vm, NULL); return NULL; } @@ -981,7 +981,7 @@ njs_json_parse_continuation(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, } if (nxt_slow_path(ret != NXT_OK)) { - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NXT_ERROR; } @@ -1019,7 +1019,7 @@ njs_json_parse_continuation(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, break; default: - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NXT_ERROR; } } @@ -1061,7 +1061,7 @@ njs_json_parse_continuation_apply(njs_vm_t *vm, njs_json_parse_t *parse) break; default: - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NXT_ERROR; } @@ -1488,7 +1488,7 @@ njs_json_stringify_to_json(njs_vm_t *vm, njs_json_stringify_t* stringify, break; default: - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NXT_ERROR; } @@ -1532,7 +1532,7 @@ njs_json_stringify_replacer(njs_vm_t *vm, njs_json_stringify_t* stringify, break; default: - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NXT_ERROR; } @@ -1627,7 +1627,7 @@ njs_json_push_stringify_state(njs_vm_t *vm, njs_json_stringify_t *stringify, if (stringify->stack.items >= 32) { njs_type_error(stringify->vm, - "Nested too deep or a cyclic structure", NULL); + "Nested too deep or a cyclic structure"); return NULL; } @@ -1717,7 +1717,7 @@ njs_json_append_value(njs_json_stringify_t *stringify, njs_value_t *value) return njs_json_buf_append(stringify, "null", 4); default: - njs_type_error(stringify->vm, "Non-serializable object", NULL); + njs_type_error(stringify->vm, "Non-serializable object"); return NXT_DECLINED; } } diff --git a/njs/njs_module.c b/njs/njs_module.c index 0c7f9025..ca80cf6b 100644 --- a/njs/njs_module.c +++ b/njs/njs_module.c @@ -43,7 +43,7 @@ njs_ret_t njs_module_require(njs_vm_t *vm, njs_value_t *args, nxt_lvlhsh_query_t lhq; if (nargs < 2) { - njs_type_error(vm, "missing path", NULL); + njs_type_error(vm, "missing path"); return NJS_ERROR; } diff --git a/njs/njs_number.c b/njs/njs_number.c index 69622baf..b9e642a6 100644 --- a/njs/njs_number.c +++ b/njs/njs_number.c @@ -611,7 +611,7 @@ njs_number_prototype_to_string(njs_vm_t *vm, njs_value_t *args, radix = args[1].data.u.number; if (radix < 2 || radix > 36 || radix != (int) radix) { - njs_range_error(vm, NULL, NULL); + njs_range_error(vm, NULL); return NXT_ERROR; } diff --git a/njs/njs_object.c b/njs/njs_object.c index 88ad3933..ab42e215 100644 --- a/njs/njs_object.c +++ b/njs/njs_object.c @@ -333,7 +333,7 @@ njs_property_query(njs_vm_t *vm, njs_property_query_t *pq, njs_value_t *object, } } - njs_type_error(vm, "cannot get property 'unknown' of undefined", NULL); + njs_type_error(vm, "cannot get property 'unknown' of undefined"); return NXT_ERROR; } @@ -727,14 +727,14 @@ njs_object_define_property(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, } if (!value->data.u.object->extensible) { - njs_type_error(vm, "object is not extensible", NULL); + njs_type_error(vm, "object is not extensible"); return NXT_ERROR; } descriptor = njs_arg(args, nargs, 3); if (!njs_is_object(descriptor)){ - njs_type_error(vm, "descriptor is not an object", NULL); + njs_type_error(vm, "descriptor is not an object"); return NXT_ERROR; } @@ -774,14 +774,14 @@ njs_object_define_properties(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, } if (!value->data.u.object->extensible) { - njs_type_error(vm, "object is not extensible", NULL); + njs_type_error(vm, "object is not extensible"); return NXT_ERROR; } descriptor = njs_arg(args, nargs, 2); if (!njs_is_object(descriptor)) { - njs_type_error(vm, "descriptor is not an object", NULL); + njs_type_error(vm, "descriptor is not an object"); return NXT_ERROR; } @@ -1395,7 +1395,7 @@ njs_property_prototype_create(njs_vm_t *vm, nxt_lvlhsh_t *hash, } /* Memory allocation or NXT_DECLINED error. */ - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NULL; } @@ -1638,7 +1638,7 @@ njs_property_constructor_create(njs_vm_t *vm, nxt_lvlhsh_t *hash, } /* Memory allocation or NXT_DECLINED error. */ - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); return NULL; } diff --git a/njs/njs_parser.c b/njs/njs_parser.c index eba4a002..1c9fba53 100644 --- a/njs/njs_parser.c +++ b/njs/njs_parser.c @@ -752,8 +752,7 @@ njs_parser_return_statement(njs_vm_t *vm, njs_parser_t *parser) scope = scope->parent) { if (scope->type == NJS_SCOPE_GLOBAL) { - njs_parser_syntax_error(vm, parser, "Illegal return statement", - NULL); + njs_parser_syntax_error(vm, parser, "Illegal return statement"); return NXT_ERROR; } @@ -1037,7 +1036,7 @@ njs_parser_switch_statement(njs_vm_t *vm, njs_parser_t *parser) if (dflt != NULL) { njs_parser_syntax_error(vm, parser, "More than one default clause " - "in switch statement", NULL); + "in switch statement"); return NJS_TOKEN_ILLEGAL; } @@ -2575,7 +2574,7 @@ njs_parser_unexpected_token(njs_vm_t *vm, njs_parser_t *parser, parser->lexer->text.start); } else { - njs_parser_syntax_error(vm, parser, "Unexpected end of input", NULL); + njs_parser_syntax_error(vm, parser, "Unexpected end of input"); } return NJS_TOKEN_ILLEGAL; diff --git a/njs/njs_parser_expression.c b/njs/njs_parser_expression.c index 1b55ee72..fb9d5af8 100644 --- a/njs/njs_parser_expression.c +++ b/njs/njs_parser_expression.c @@ -277,7 +277,7 @@ njs_parser_var_expression(njs_vm_t *vm, njs_parser_t *parser, njs_token_t token) if (!njs_parser_is_lvalue(parser->node)) { njs_parser_ref_error(vm, parser, - "Invalid left-hand side in assignment", NULL); + "Invalid left-hand side in assignment"); return NJS_TOKEN_ILLEGAL; } @@ -415,7 +415,7 @@ njs_parser_assignment_expression(njs_vm_t *vm, njs_parser_t *parser, if (!njs_parser_is_lvalue(parser->node)) { njs_parser_ref_error(vm, parser, - "Invalid left-hand side in assignment", NULL); + "Invalid left-hand side in assignment"); return NJS_TOKEN_ILLEGAL; } @@ -839,8 +839,7 @@ njs_parser_inc_dec_expression(njs_vm_t *vm, njs_parser_t *parser, if (!njs_parser_is_lvalue(parser->node)) { njs_parser_ref_error(vm, parser, - "Invalid left-hand side in prefix operation", - NULL); + "Invalid left-hand side in prefix operation"); return NJS_TOKEN_ILLEGAL; } @@ -894,8 +893,7 @@ njs_parser_post_inc_dec_expression(njs_vm_t *vm, njs_parser_t *parser, if (!njs_parser_is_lvalue(parser->node)) { njs_parser_ref_error(vm, parser, - "Invalid left-hand side in postfix operation", - NULL); + "Invalid left-hand side in postfix operation"); return NJS_TOKEN_ILLEGAL; } diff --git a/njs/njs_regexp.c b/njs/njs_regexp.c index 92954585..9fa044ee 100644 --- a/njs/njs_regexp.c +++ b/njs/njs_regexp.c @@ -320,7 +320,7 @@ njs_regexp_pattern_create(njs_vm_t *vm, u_char *start, size_t length, if (nxt_fast_path(ret >= 0)) { if (nxt_slow_path((u_int) ret != pattern->ncaptures)) { - njs_internal_error(vm, NULL, NULL); + njs_internal_error(vm, NULL); nxt_mem_cache_free(vm->mem_cache_pool, pattern); return NULL; } @@ -412,7 +412,7 @@ njs_regexp_match_trace_handler(nxt_trace_t *trace, nxt_trace_data_t *td, trace = trace->next; p = trace->handler(trace, td, start); - njs_internal_error(vm, (const char *) start, NULL); + njs_internal_error(vm, (const char *) start); return p; } @@ -545,7 +545,7 @@ njs_regexp_prototype_to_string(njs_vm_t *vm, njs_value_t *args, return njs_regexp_string_create(vm, &vm->retval, source, size, length); } - njs_type_error(vm, "'this' argument is not a regexp", NULL); + njs_type_error(vm, "'this' argument is not a regexp"); return NXT_ERROR; } @@ -563,7 +563,7 @@ njs_regexp_prototype_test(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_regexp_pattern_t *pattern; if (!njs_is_regexp(&args[0])) { - njs_type_error(vm, "'this' argument is not a regexp", NULL); + njs_type_error(vm, "'this' argument is not a regexp"); return NXT_ERROR; } @@ -613,7 +613,7 @@ njs_regexp_prototype_exec(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, nxt_regex_match_data_t *match_data; if (!njs_is_regexp(&args[0])) { - njs_type_error(vm, "'this' argument is not a regexp", NULL); + njs_type_error(vm, "'this' argument is not a regexp"); return NXT_ERROR; } diff --git a/njs/njs_string.c b/njs/njs_string.c index b438f586..b059dd7f 100644 --- a/njs/njs_string.c +++ b/njs/njs_string.c @@ -732,7 +732,7 @@ njs_string_prototype_to_string(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs } if (nxt_slow_path(!njs_is_string(&args[1]))) { - njs_type_error(vm, "encoding must be a string", NULL); + njs_type_error(vm, "encoding must be a string"); return NJS_ERROR; } @@ -741,7 +741,7 @@ njs_string_prototype_to_string(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs (void) njs_string_prop(&string, &value); if (nxt_slow_path(string.length != 0)) { - njs_type_error(vm, "argument must be a byte string", NULL); + njs_type_error(vm, "argument must be a byte string"); return NJS_ERROR; } @@ -781,7 +781,7 @@ njs_string_prototype_concat(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_string_prop_t string; if (njs_is_null_or_void(&args[0])) { - njs_type_error(vm, "'this' argument is null or undefined", NULL); + njs_type_error(vm, "'this' argument is null or undefined"); return NXT_ERROR; } @@ -1376,7 +1376,7 @@ njs_string_from_char_code(njs_vm_t *vm, njs_value_t *args, range_error: - njs_range_error(vm, NULL, NULL); + njs_range_error(vm, NULL); return NXT_ERROR; } @@ -2043,7 +2043,7 @@ njs_string_prototype_repeat(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, n = args[1].data.u.number; if (nxt_slow_path(n < 0 || n >= max)) { - njs_range_error(vm, NULL, NULL); + njs_range_error(vm, NULL); return NXT_ERROR; } } @@ -3859,7 +3859,7 @@ njs_string_decode(njs_vm_t *vm, njs_value_t *value, const uint32_t *reserve) uri_error: - njs_uri_error(vm, NULL, NULL); + njs_uri_error(vm, NULL); return NXT_ERROR; } diff --git a/njs/njs_time.c b/njs/njs_time.c index 23b5e73a..42642dfa 100644 --- a/njs/njs_time.c +++ b/njs/njs_time.c @@ -19,18 +19,18 @@ njs_set_timeout(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, njs_vm_ops_t *ops; if (nxt_slow_path(nargs < 2)) { - njs_type_error(vm, "too few arguments", NULL); + njs_type_error(vm, "too few arguments"); return NJS_ERROR; } if (nxt_slow_path(!njs_is_function(&args[1]))) { - njs_type_error(vm, "first arg must be a function", NULL); + njs_type_error(vm, "first arg must be a function"); return NJS_ERROR; } ops = vm->ops; if (nxt_slow_path(ops == NULL)) { - njs_internal_error(vm, "not supported by host environment", NULL); + njs_internal_error(vm, "not supported by host environment"); return NJS_ERROR; } @@ -62,7 +62,7 @@ njs_set_timeout(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs, event->host_event = ops->set_timer(vm->external, delay, event); if (event->host_event == NULL) { - njs_internal_error(vm, "set_timer() failed", NULL); + njs_internal_error(vm, "set_timer() failed"); return NJS_ERROR; } diff --git a/njs/njs_variable.c b/njs/njs_variable.c index 022ab858..8c1be25e 100644 --- a/njs/njs_variable.c +++ b/njs/njs_variable.c @@ -376,7 +376,7 @@ njs_variable_get(njs_vm_t *vm, njs_parser_node_t *node) index = (index >> NJS_SCOPE_SHIFT) + 1; if (index > 255 || vs.scope->argument_closures == 0) { - njs_internal_error(vm, "too many argument closures", NULL); + njs_internal_error(vm, "too many argument closures"); return NULL; } diff --git a/njs/njs_vm.c b/njs/njs_vm.c index 0119ec53..11192721 100644 --- a/njs/njs_vm.c +++ b/njs/njs_vm.c @@ -755,7 +755,7 @@ njs_vmcode_property_in(njs_vm_t *vm, njs_value_t *object, njs_value_t *property) case NJS_PRIMITIVE_VALUE: case NJS_STRING_VALUE: - njs_type_error(vm, "property in on a primitive value", NULL); + njs_type_error(vm, "property in on a primitive value"); return NXT_ERROR; @@ -1066,7 +1066,7 @@ njs_vmcode_instance_of(njs_vm_t *vm, njs_value_t *object, static njs_value_t prototype_string = njs_string("prototype"); if (!njs_is_function(constructor)) { - njs_type_error(vm, "right argument is not a function", NULL); + njs_type_error(vm, "right argument is not a function"); return NXT_ERROR; } @@ -1977,7 +1977,7 @@ njs_function_frame_create(njs_vm_t *vm, njs_value_t *value, } } - njs_type_error(vm, "object is not callable", NULL); + njs_type_error(vm, "object is not callable"); return NXT_ERROR; } @@ -3084,8 +3084,7 @@ njs_primitive_value(njs_vm_t *vm, njs_value_t *value, nxt_uint_t hint) } if (ret == NXT_ERROR) { - njs_type_error(vm, "cannot evaluate an object's value", - NULL); + njs_type_error(vm, "cannot evaluate an object's value"); } return ret;