mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-23865 Create malloc function attribute
This commit is contained in:
parent
cee9b3b850
commit
26b96094ec
2 changed files with 6 additions and 0 deletions
|
@ -156,6 +156,7 @@ program. The paths leading to call of cold functions within code are
|
|||
marked as unlikely by the branch prediction mechanism. optimize a
|
||||
rarely invoked function for size instead for speed. */
|
||||
# define ATTRIBUTE_COLD __attribute__((cold))
|
||||
# define ATTRIBUTE_MALLOC __attribute__((malloc))
|
||||
#elif defined _MSC_VER
|
||||
# define ATTRIBUTE_NORETURN __declspec(noreturn)
|
||||
# define ATTRIBUTE_NOINLINE __declspec(noinline)
|
||||
|
@ -168,6 +169,10 @@ rarely invoked function for size instead for speed. */
|
|||
# define ATTRIBUTE_COLD /* empty */
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_MALLOC
|
||||
# define ATTRIBUTE_MALLOC
|
||||
#endif
|
||||
|
||||
#include <my_attribute.h>
|
||||
|
||||
#endif /* MY_COMPILER_INCLUDED */
|
||||
|
|
|
@ -62,6 +62,7 @@ void set_malloc_size_cb(MALLOC_SIZE_CB func)
|
|||
|
||||
@return A pointer to the allocated memory block, or NULL on failure.
|
||||
*/
|
||||
ATTRIBUTE_MALLOC
|
||||
void *my_malloc(PSI_memory_key key, size_t size, myf my_flags)
|
||||
{
|
||||
my_memory_header *mh;
|
||||
|
|
Loading…
Reference in a new issue