[njs] Adding const qualifier njs_string_prop().

Dmitry Volyntsev xeioex at nginx.com
Wed Mar 27 18:11:01 UTC 2019


details:   https://hg.nginx.org/njs/rev/4139cb5a7412
branches:  
changeset: 851:4139cb5a7412
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Mar 27 21:00:18 2019 +0300
description:
Adding const qualifier njs_string_prop().

diffstat:

 njs/njs_string.c |  6 +++---
 njs/njs_string.h |  2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r ab2264c8f37f -r 4139cb5a7412 njs/njs_string.c
--- a/njs/njs_string.c	Mon Apr 16 19:28:07 2018 +0300
+++ b/njs/njs_string.c	Wed Mar 27 21:00:18 2019 +0300
@@ -511,7 +511,7 @@ njs_string_validate(njs_vm_t *vm, njs_st
 
 
 nxt_noinline size_t
-njs_string_prop(njs_string_prop_t *string, njs_value_t *value)
+njs_string_prop(njs_string_prop_t *string, const njs_value_t *value)
 {
     size_t     size;
     uintptr_t  length;
@@ -519,11 +519,11 @@ njs_string_prop(njs_string_prop_t *strin
     size = value->short_string.size;
 
     if (size != NJS_STRING_LONG) {
-        string->start = value->short_string.start;
+        string->start = (u_char *) value->short_string.start;
         length = value->short_string.length;
 
     } else {
-        string->start = value->long_string.data->start;
+        string->start = (u_char *) value->long_string.data->start;
         size = value->long_string.size;
         length = value->long_string.data->length;
     }
diff -r ab2264c8f37f -r 4139cb5a7412 njs/njs_string.h
--- a/njs/njs_string.h	Mon Apr 16 19:28:07 2018 +0300
+++ b/njs/njs_string.h	Wed Mar 27 21:00:18 2019 +0300
@@ -144,7 +144,7 @@ void njs_string_copy(njs_value_t *dst, n
 njs_ret_t njs_string_validate(njs_vm_t *vm, njs_string_prop_t *string,
     njs_value_t *value);
 nxt_noinline size_t njs_string_prop(njs_string_prop_t *string,
-    njs_value_t *value);
+    const njs_value_t *value);
 njs_ret_t njs_string_constructor(njs_vm_t *vm, njs_value_t *args,
     nxt_uint_t nargs, njs_index_t unused);
 nxt_bool_t njs_string_eq(const njs_value_t *val1, const njs_value_t *val2);


More information about the nginx-devel mailing list