From 06eb32ebfb6d312aab799b1e32054895d19ba110 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Mon, 18 Jan 2016 20:02:35 +0300 Subject: [PATCH] Using C99 syntax for static structures initializaion. --- njs/njs_array.c | 148 +++++++++++++++++++++++--------------- njs/njs_boolean.c | 52 ++++++++------ njs/njs_builtin.c | 6 +- njs/njs_function.c | 68 +++++++++++------- njs/njs_number.c | 48 ++++++++----- njs/njs_object.c | 72 +++++++++++-------- njs/njs_regexp.c | 102 +++++++++++++++----------- njs/njs_string.c | 176 ++++++++++++++++++++++++++++----------------- 8 files changed, 412 insertions(+), 260 deletions(-) diff --git a/njs/njs_array.c b/njs/njs_array.c index 34cb5e05..9b4e6f65 100644 --- a/njs/njs_array.c +++ b/njs/njs_array.c @@ -221,19 +221,25 @@ njs_array_constructor(njs_vm_t *vm, njs_param_t *param) static const njs_object_prop_t njs_array_constructor_properties[] = { /* Array.name == "Array". */ - { njs_string("Array"), - njs_string("name"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("name"), + .value = njs_string("Array"), + }, /* Array.length == 1. */ - { njs_value(NJS_NUMBER, 1, 1.0), - njs_string("length"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("length"), + .value = njs_value(NJS_NUMBER, 1, 1.0), + }, /* Array.prototype. */ - { njs_native_getter(njs_object_prototype_create), - njs_string("prototype"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("prototype"), + .value = njs_native_getter(njs_object_prototype_create), + }, }; @@ -893,56 +899,80 @@ njs_array_next(njs_value_t *value, nxt_uint_t n, nxt_uint_t length) static const njs_object_prop_t njs_array_prototype_properties[] = { - { njs_native_getter(njs_array_prototype_length), - njs_string("length"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_slice, 0), - njs_string("slice"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_push, 0), - njs_string("push"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_pop, 0), - njs_string("pop"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_unshift, 0), - njs_string("unshift"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_shift, 0), - njs_string("shift"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_to_string, 0), - njs_string("toString"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_join, 0), - njs_string("join"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_concat, 0), - njs_string("concat"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_for_each, - njs_method_data_size(sizeof(njs_array_next_t))), - njs_string("forEach"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_some, - njs_method_data_size(sizeof(njs_array_next_t))), - njs_string("some"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_array_prototype_every, - njs_method_data_size(sizeof(njs_array_next_t))), - njs_string("every"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("length"), + .value = njs_native_getter(njs_array_prototype_length), + }, + + { + .type = NJS_METHOD, + .name = njs_string("slice"), + .value = njs_native_function(njs_array_prototype_slice, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("push"), + .value = njs_native_function(njs_array_prototype_push, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("pop"), + .value = njs_native_function(njs_array_prototype_pop, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("unshift"), + .value = njs_native_function(njs_array_prototype_unshift, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("shift"), + .value = njs_native_function(njs_array_prototype_shift, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("toString"), + .value = njs_native_function(njs_array_prototype_to_string, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("join"), + .value = njs_native_function(njs_array_prototype_join, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("concat"), + .value = njs_native_function(njs_array_prototype_concat, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("forEach"), + .value = njs_native_function(njs_array_prototype_for_each, + njs_method_data_size(sizeof(njs_array_next_t))), + }, + + { + .type = NJS_METHOD, + .name = njs_string("some"), + .value = njs_native_function(njs_array_prototype_some, + njs_method_data_size(sizeof(njs_array_next_t))), + }, + + { + .type = NJS_METHOD, + .name = njs_string("every"), + .value = njs_native_function(njs_array_prototype_every, + njs_method_data_size(sizeof(njs_array_next_t))), + }, }; diff --git a/njs/njs_boolean.c b/njs/njs_boolean.c index 4080574e..a0bdb335 100644 --- a/njs/njs_boolean.c +++ b/njs/njs_boolean.c @@ -52,19 +52,25 @@ njs_boolean_constructor(njs_vm_t *vm, njs_param_t *param) static const njs_object_prop_t njs_boolean_constructor_properties[] = { /* Boolean.name == "Boolean". */ - { njs_string("Boolean"), - njs_string("name"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("name"), + .value = njs_string("Boolean"), + }, /* Boolean.length == 1. */ - { njs_value(NJS_NUMBER, 1, 1.0), - njs_string("length"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("length"), + .value = njs_value(NJS_NUMBER, 1, 1.0), + }, /* Boolean.prototype. */ - { njs_native_getter(njs_object_prototype_create), - njs_string("prototype"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("prototype"), + .value = njs_native_getter(njs_object_prototype_create), + }, }; @@ -124,17 +130,23 @@ njs_boolean_prototype_to_string(njs_vm_t *vm, njs_param_t *param) static const njs_object_prop_t njs_boolean_prototype_properties[] = { - { njs_native_getter(njs_primitive_prototype_get_proto), - njs_string("__proto__"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_function(njs_boolean_prototype_value_of, 0), - njs_string("valueOf"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_boolean_prototype_to_string, 0), - njs_string("toString"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("__proto__"), + .value = njs_native_getter(njs_primitive_prototype_get_proto), + }, + + { + .type = NJS_METHOD, + .name = njs_string("valueOf"), + .value = njs_native_function(njs_boolean_prototype_value_of, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("toString"), + .value = njs_native_function(njs_boolean_prototype_to_string, 0), + }, }; diff --git a/njs/njs_builtin.c b/njs/njs_builtin.c index 2a5d0057..ac660be5 100644 --- a/njs/njs_builtin.c +++ b/njs/njs_builtin.c @@ -65,9 +65,9 @@ njs_builtin_objects_create(njs_vm_t *vm) }; static const njs_object_prop_t null_proto_property = { - njs_value(NJS_NULL, 0, 0.0), - njs_string("__proto__"), - NJS_WHITEOUT, 0, 0, 0, + .type = NJS_WHITEOUT, + .name = njs_string("__proto__"), + .value = njs_value(NJS_NULL, 0, 0.0), }; ret = njs_object_hash_create(vm, &vm->shared->null_proto_hash, diff --git a/njs/njs_function.c b/njs/njs_function.c index af5efaf5..9a31f649 100644 --- a/njs/njs_function.c +++ b/njs/njs_function.c @@ -237,19 +237,25 @@ njs_function_call(njs_vm_t *vm, njs_index_t retval) static const njs_object_prop_t njs_function_constructor_properties[] = { /* Function.name == "Function". */ - { njs_string("Function"), - njs_string("name"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("name"), + .value = njs_string("Function"), + }, /* Function.length == 1. */ - { njs_value(NJS_NUMBER, 0, 1.0), - njs_string("length"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("length"), + .value = njs_value(NJS_NUMBER, 1, 1.0), + }, /* Function.prototype. */ - { njs_native_getter(njs_object_prototype_create), - njs_string("prototype"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("prototype"), + .value = njs_native_getter(njs_object_prototype_create), + }, }; @@ -413,17 +419,23 @@ njs_function_prototype_bind(njs_vm_t *vm, njs_param_t *param) static const njs_object_prop_t njs_function_prototype_properties[] = { - { njs_native_function(njs_function_prototype_call, 0), - njs_string("call"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_function_prototype_apply, 0), - njs_string("apply"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_function_prototype_bind, 0), - njs_string("bind"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("call"), + .value = njs_native_function(njs_function_prototype_call, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("apply"), + .value = njs_native_function(njs_function_prototype_apply, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("bind"), + .value = njs_native_function(njs_function_prototype_bind, 0), + }, }; @@ -443,14 +455,18 @@ njs_eval_function(njs_vm_t *vm, njs_param_t *param) static const njs_object_prop_t njs_eval_function_properties[] = { /* eval.name == "eval". */ - { njs_string("eval"), - njs_string("name"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("name"), + .value = njs_string("eval"), + }, /* eval.length == 1. */ - { njs_value(NJS_NUMBER, 0, 1.0), - njs_string("length"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("length"), + .value = njs_value(NJS_NUMBER, 1, 1.0), + }, }; diff --git a/njs/njs_number.c b/njs/njs_number.c index 6b44b150..53ee7671 100644 --- a/njs/njs_number.c +++ b/njs/njs_number.c @@ -247,19 +247,25 @@ njs_number_constructor(njs_vm_t *vm, njs_param_t *param) static const njs_object_prop_t njs_number_constructor_properties[] = { /* Number.name == "Number". */ - { njs_string("Number"), - njs_string("name"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("name"), + .value = njs_string("Number"), + }, /* Number.length == 1. */ - { njs_value(NJS_NUMBER, 1, 1.0), - njs_string("length"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("length"), + .value = njs_value(NJS_NUMBER, 1, 1.0), + }, /* Number.prototype. */ - { njs_native_getter(njs_object_prototype_create), - njs_string("prototype"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("prototype"), + .value = njs_native_getter(njs_object_prototype_create), + }, }; @@ -317,17 +323,23 @@ njs_number_prototype_to_string(njs_vm_t *vm, njs_param_t *param) static const njs_object_prop_t njs_number_prototype_properties[] = { - { njs_native_getter(njs_primitive_prototype_get_proto), - njs_string("__proto__"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("__proto__"), + .value = njs_native_getter(njs_primitive_prototype_get_proto), + }, - { njs_native_function(njs_number_prototype_value_of, 0), - njs_string("valueOf"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("valueOf"), + .value = njs_native_function(njs_number_prototype_value_of, 0), + }, - { njs_native_function(njs_number_prototype_to_string, 0), - njs_string("toString"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("toString"), + .value = njs_native_function(njs_number_prototype_to_string, 0), + }, }; diff --git a/njs/njs_object.c b/njs/njs_object.c index f538217d..a412ec8a 100644 --- a/njs/njs_object.c +++ b/njs/njs_object.c @@ -388,25 +388,33 @@ njs_object_prototype_create(njs_vm_t *vm, njs_value_t *value) static const njs_object_prop_t njs_object_constructor_properties[] = { - /* Object.name == "name". */ - { njs_string("Object"), - njs_string("name"), - NJS_PROPERTY, 0, 0, 0, }, + /* Object.name == "Object". */ + { + .type = NJS_PROPERTY, + .name = njs_string("name"), + .value = njs_string("Object"), + }, /* Object.length == 1. */ - { njs_value(NJS_NUMBER, 1, 1.0), - njs_string("length"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("length"), + .value = njs_value(NJS_NUMBER, 1, 1.0), + }, /* Object.prototype. */ - { njs_native_getter(njs_object_prototype_create), - njs_string("prototype"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("prototype"), + .value = njs_native_getter(njs_object_prototype_create), + }, /* Object.create(). */ - { njs_native_function(njs_object_create, 0), - njs_string("create"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("create"), + .value = njs_native_function(njs_object_create, 0), + }, }; @@ -599,21 +607,29 @@ found: static const njs_object_prop_t njs_object_prototype_properties[] = { - { njs_native_getter(njs_object_prototype_get_proto), - njs_string("__proto__"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_getter(njs_object_prototype_create_constructor), - njs_string("constructor"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_function(njs_object_prototype_value_of, 0), - njs_string("valueOf"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_object_prototype_to_string, 0), - njs_string("toString"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("__proto__"), + .value = njs_native_getter(njs_object_prototype_get_proto), + }, + + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("constructor"), + .value = njs_native_getter(njs_object_prototype_create_constructor), + }, + + { + .type = NJS_METHOD, + .name = njs_string("valueOf"), + .value = njs_native_function(njs_object_prototype_value_of, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("toString"), + .value = njs_native_function(njs_object_prototype_to_string, 0), + }, }; diff --git a/njs/njs_regexp.c b/njs/njs_regexp.c index 8351ac23..91945332 100644 --- a/njs/njs_regexp.c +++ b/njs/njs_regexp.c @@ -666,19 +666,25 @@ njs_regexp_exec_result(njs_vm_t *vm, njs_regexp_t *regexp, u_char *string, static const njs_object_prop_t njs_regexp_constructor_properties[] = { /* RegExp.name == "RegExp". */ - { njs_string("RegExp"), - njs_string("name"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("name"), + .value = njs_string("RegExp"), + }, /* RegExp.length == 2. */ - { njs_value(NJS_NUMBER, 1, 2.0), - njs_string("length"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("length"), + .value = njs_value(NJS_NUMBER, 1, 2.0), + }, /* RegExp.prototype. */ - { njs_native_getter(njs_object_prototype_create), - njs_string("prototype"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("prototype"), + .value = njs_native_getter(njs_object_prototype_create), + }, }; @@ -690,37 +696,53 @@ const njs_object_init_t njs_regexp_constructor_init = { static const njs_object_prop_t njs_regexp_prototype_properties[] = { - { njs_native_getter(njs_regexp_prototype_last_index), - njs_string("lastIndex"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_getter(njs_regexp_prototype_global), - njs_string("global"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_getter(njs_regexp_prototype_ignore_case), - njs_string("ignoreCase"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_getter(njs_regexp_prototype_multiline), - njs_string("multiline"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_getter(njs_regexp_prototype_source), - njs_string("source"), - NJS_NATIVE_GETTER, 0, 0, 0, }, - - { njs_native_function(njs_regexp_prototype_to_string, 0), - njs_string("toString"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_regexp_prototype_test, 0), - njs_string("test"), - NJS_METHOD, 0, 0, 0, }, - - { njs_native_function(njs_regexp_prototype_exec, 0), - njs_string("exec"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("lastIndex"), + .value = njs_native_getter(njs_regexp_prototype_last_index), + }, + + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("global"), + .value = njs_native_getter(njs_regexp_prototype_global), + }, + + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("ignoreCase"), + .value = njs_native_getter(njs_regexp_prototype_ignore_case), + }, + + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("multiline"), + .value = njs_native_getter(njs_regexp_prototype_multiline), + }, + + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("source"), + .value = njs_native_getter(njs_regexp_prototype_source), + }, + + { + .type = NJS_METHOD, + .name = njs_string("toString"), + .value = njs_native_function(njs_regexp_prototype_to_string, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("test"), + .value = njs_native_function(njs_regexp_prototype_test, 0), + }, + + { + .type = NJS_METHOD, + .name = njs_string("exec"), + .value = njs_native_function(njs_regexp_prototype_exec, 0), + }, }; diff --git a/njs/njs_string.c b/njs/njs_string.c index 020a80da..13fe0661 100644 --- a/njs/njs_string.c +++ b/njs/njs_string.c @@ -285,19 +285,25 @@ njs_string_constructor(njs_vm_t *vm, njs_param_t *param) static const njs_object_prop_t njs_string_constructor_properties[] = { /* String.name == "String". */ - { njs_string("String"), - njs_string("name"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("name"), + .value = njs_string("String"), + }, /* String.length == 1. */ - { njs_value(NJS_NUMBER, 1, 1.0), - njs_string("length"), - NJS_PROPERTY, 0, 0, 0, }, + { + .type = NJS_PROPERTY, + .name = njs_string("length"), + .value = njs_value(NJS_NUMBER, 1, 1.0), + }, /* String.prototype. */ - { njs_native_getter(njs_object_prototype_create), - njs_string("prototype"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("prototype"), + .value = njs_native_getter(njs_object_prototype_create), + }, }; @@ -1593,83 +1599,121 @@ njs_string_to_number(njs_value_t *value) static const njs_object_prop_t njs_string_prototype_properties[] = { - { njs_native_getter(njs_primitive_prototype_get_proto), - njs_string("__proto__"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("__proto__"), + .value = njs_native_getter(njs_primitive_prototype_get_proto), + }, - { njs_native_getter(njs_string_prototype_length), - njs_string("length"), - NJS_NATIVE_GETTER, 0, 0, 0, }, + { + .type = NJS_NATIVE_GETTER, + .name = njs_string("length"), + .value = njs_native_getter(njs_string_prototype_length), + }, - { njs_native_function(njs_string_prototype_value_of, 0), - njs_string("valueOf"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("valueOf"), + .value = njs_native_function(njs_string_prototype_value_of, 0), + }, - { njs_native_function(njs_string_prototype_value_of, 0), - njs_string("toString"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("toString"), + .value = njs_native_function(njs_string_prototype_value_of, 0), + }, - { njs_native_function(njs_string_prototype_concat, 0), - njs_string("concat"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("concat"), + .value = njs_native_function(njs_string_prototype_concat, 0), + }, - { njs_native_function(njs_string_prototype_from_utf8, 0), - njs_string("fromUTF8"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("fromUTF8"), + .value = njs_native_function(njs_string_prototype_from_utf8, 0), + }, - { njs_native_function(njs_string_prototype_to_utf8, 0), - njs_string("toUTF8"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("toUTF8"), + .value = njs_native_function(njs_string_prototype_to_utf8, 0), + }, - { njs_native_function(njs_string_prototype_from_bytes, 0), - njs_string("fromBytes"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("fromBytes"), + .value = njs_native_function(njs_string_prototype_from_bytes, 0), + }, - { njs_native_function(njs_string_prototype_to_bytes, 0), - njs_string("toBytes"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("toBytes"), + .value = njs_native_function(njs_string_prototype_to_bytes, 0), + }, - { njs_native_function(njs_string_prototype_slice, 0), - njs_string("slice"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("slice"), + .value = njs_native_function(njs_string_prototype_slice, 0), + }, - { njs_native_function(njs_string_prototype_substring, 0), - njs_string("substring"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("substring"), + .value = njs_native_function(njs_string_prototype_substring, 0), + }, - { njs_native_function(njs_string_prototype_substr, 0), - njs_string("substr"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("substr"), + .value = njs_native_function(njs_string_prototype_substr, 0), + }, - { njs_native_function(njs_string_prototype_char_at, 0), - njs_string("charAt"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("charAt"), + .value = njs_native_function(njs_string_prototype_char_at, 0), + }, - { njs_native_function(njs_string_prototype_char_code_at, 0), - njs_string("charCodeAt"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("charCodeAt"), + .value = njs_native_function(njs_string_prototype_char_code_at, 0), + }, /* ECMAScript 6, codePointAt(). */ - { njs_native_function(njs_string_prototype_char_code_at, 0), - njs_string("codePointAt"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("codePointAt"), + .value = njs_native_function(njs_string_prototype_char_code_at, 0), + }, - { njs_native_function(njs_string_prototype_index_of, 0), - njs_string("indexOf"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("indexOf"), + .value = njs_native_function(njs_string_prototype_index_of, 0), + }, - { njs_native_function(njs_string_prototype_last_index_of, 0), - njs_string("lastIndexOf"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("lastIndexOf"), + .value = njs_native_function(njs_string_prototype_last_index_of, 0), + }, - { njs_native_function(njs_string_prototype_search, 0), - njs_string("search"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("search"), + .value = njs_native_function(njs_string_prototype_search, 0), + }, - { njs_native_function(njs_string_prototype_match, 0), - njs_string("match"), - NJS_METHOD, 0, 0, 0, }, + { + .type = NJS_METHOD, + .name = njs_string("match"), + .value = njs_native_function(njs_string_prototype_match, 0), + }, }; -- 2.47.3