]> git.kaiwu.me - njs.git/commitdiff
Using C99 syntax for static structures initializaion.
authorIgor Sysoev <igor@sysoev.ru>
Mon, 18 Jan 2016 17:02:35 +0000 (20:02 +0300)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 18 Jan 2016 17:02:35 +0000 (20:02 +0300)
njs/njs_array.c
njs/njs_boolean.c
njs/njs_builtin.c
njs/njs_function.c
njs/njs_number.c
njs/njs_object.c
njs/njs_regexp.c
njs/njs_string.c

index 34cb5e05d1dd53d0028860da1f710ac74b13aad1..9b4e6f65013071215effd01cd4e6374255107a89 100644 (file)
@@ -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))),
+    },
 };
 
 
index 4080574eac74378d49c7c91beba4721b9b9f7c84..a0bdb335b8b3a6103e311a33a0cd462bcc7183c2 100644 (file)
@@ -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),
+    },
 };
 
 
index 2a5d0057aea420d8d7621f9eb5f751b3826b10dd..ac660be5a9683c8b1bcce0762c90a9e8c37ab637 100644 (file)
@@ -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,
index af5efaf57ef8a71154c21b046bbaae3c191d6f9b..9a31f6491378ef30ec2a348590a6f8b0412beb71 100644 (file)
@@ -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),
+    },
 };
 
 
index 6b44b150a1c441d41a76fc5945f646d40039c54c..53ee76715ed402735532914c412aa0db8550ecea 100644 (file)
@@ -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),
+    },
 };
 
 
index f538217d1c855787b1a68c5c4aee59782c6c431d..a412ec8a0de06516050193363edad978b6f3dbe6 100644 (file)
@@ -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),
+    },
 };
 
 
index 8351ac234ad0c548e039a51f1bb438d46dfbcba2..91945332fd9f4c073c062a81483db34361872bd9 100644 (file)
@@ -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),
+    },
 };
 
 
index 020a80da0170e432abcfa1995b5360ba893ecb8e..13fe0661d757131fb0fb076054d7eee2e043665a 100644 (file)
@@ -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),
+    },
 };