[njs] Removed njs_buffer_decode_destroy().

Dmitry Volyntsev xeioex at nginx.com
Sat Jun 11 07:16:57 UTC 2022


details:   https://hg.nginx.org/njs/rev/cb0b5507ffe6
branches:  
changeset: 1885:cb0b5507ffe6
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Sat Jun 11 00:15:28 2022 -0700
description:
Removed njs_buffer_decode_destroy().

diffstat:

 src/njs_buffer.c |  27 +--------------------------
 1 files changed, 1 insertions(+), 26 deletions(-)

diffs (72 lines):

diff -r 46ec9152a054 -r cb0b5507ffe6 src/njs_buffer.c
--- a/src/njs_buffer.c	Sat Jun 11 00:15:28 2022 -0700
+++ b/src/njs_buffer.c	Sat Jun 11 00:15:28 2022 -0700
@@ -76,8 +76,6 @@ static njs_int_t njs_buffer_fill_string(
 static njs_int_t njs_buffer_fill_typed_array(njs_vm_t *vm,
     const njs_value_t *value, njs_typed_array_t *array, uint8_t *start,
     uint8_t *end);
-static void njs_buffer_decode_destroy(njs_vm_t *vm, const njs_value_t *source,
-    njs_value_t *target);
 
 static njs_int_t njs_buffer(njs_vm_t *vm,
     njs_object_prop_t *prop, njs_value_t *value, njs_value_t *setval,
@@ -528,8 +526,6 @@ njs_buffer_from_string(njs_vm_t *vm, njs
 
     memcpy(njs_typed_array_buffer(buffer)->u.u8, str.start, str.length);
 
-    njs_buffer_decode_destroy(vm, value, &dst);
-
     njs_set_typed_array(&vm->retval, buffer);
 
     return NJS_OK;
@@ -1589,8 +1585,6 @@ njs_buffer_write_string(njs_vm_t *vm, nj
 
 done:
 
-    njs_buffer_decode_destroy(vm, value, &dst);
-
     njs_set_number(&vm->retval, length);
 
     return NJS_OK;
@@ -1745,7 +1739,7 @@ njs_buffer_fill_string(njs_vm_t *vm, con
 
     if (str.length == 0) {
         memset(start, 0, end - start);
-        goto done;
+        return NJS_OK;
     }
 
     while (start < end) {
@@ -1753,10 +1747,6 @@ njs_buffer_fill_string(njs_vm_t *vm, con
         start = njs_cpymem(start, str.start, n);
     }
 
-done:
-
-    njs_buffer_decode_destroy(vm, value, &dst);
-
     return NJS_OK;
 }
 
@@ -2345,21 +2335,6 @@ njs_buffer_decode_string(njs_vm_t *vm, c
 }
 
 
-static void
-njs_buffer_decode_destroy(njs_vm_t *vm, const njs_value_t *source,
-    njs_value_t *target)
-{
-    njs_str_t  src, trg;
-
-    njs_string_get(source, &src);
-    njs_string_get(target, &trg);
-
-    if (src.start != trg.start) {
-        njs_mp_free(vm->mem_pool, trg.start);
-    }
-}
-
-
 static const njs_object_prop_t  njs_buffer_prototype_properties[] =
 {
     {



More information about the nginx-devel mailing list