]> git.kaiwu.me - njs.git/commit
Removed misused __attribute__((malloc)).
authorValentin Bartenev <vbart@nginx.com>
Thu, 10 Nov 2016 13:47:52 +0000 (16:47 +0300)
committerValentin Bartenev <vbart@nginx.com>
Thu, 10 Nov 2016 13:47:52 +0000 (16:47 +0300)
commit0e58cbec309b9b2142d111237c044f8a87b675ac
treed2ac7fcebec900b51952ace4fa5f18dbf1f25cd9
parent5f082e0d50c212595c5b9905963e4de3d8b7032c
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