From 0e58cbec309b9b2142d111237c044f8a87b675ac Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Thu, 10 Nov 2016 16:47:52 +0300 Subject: [PATCH] Removed misused __attribute__((malloc)). According to the documentation: | This tells the compiler that a function is malloc-like, i.e., that the | pointer P returned by the function cannot alias any other pointer valid | when the function returns, and moreover no pointers to valid objects | occur in any storage addressed by P. The njs_string_alloc() allocates a storage for a string and makes the storage accessible via the passed "value" argument. The function also returns an intermediate pointer which is used only for string content initialization and then discarded. Since the pointer is not stored anywhere after the initialization, GCC with -O or higher optimisation levels rightfully optimizes out the initialization. --- njs/njs_string.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/njs/njs_string.h b/njs/njs_string.h index a06a3cc2..054944dd 100644 --- a/njs/njs_string.h +++ b/njs/njs_string.h @@ -112,8 +112,7 @@ njs_string_length(njs_utf8_t utf8, u_char *start, size_t size) njs_ret_t njs_string_new(njs_vm_t *vm, njs_value_t *value, const u_char *start, uint32_t size, uint32_t length); u_char *njs_string_alloc(njs_vm_t *vm, njs_value_t *value, uint32_t size, - uint32_t length) - NXT_MALLOC_LIKE; + uint32_t length); void njs_string_copy(njs_value_t *dst, njs_value_t *src); njs_ret_t njs_string_validate(njs_vm_t *vm, njs_string_prop_t *string, njs_value_t *value); -- 2.47.3