chromium/third_party/ffmpeg/libavutil/mem.c

/*
 * default memory allocator for libavutil
 * Copyright (c) 2002 Fabrice Bellard
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

/**
 * @file
 * default memory allocator for libavutil
 */

#define _XOPEN_SOURCE

#include "config.h"

#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdatomic.h>
#include <string.h>
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

#include "attributes.h"
#include "avassert.h"
#include "dynarray.h"
#include "error.h"
#include "internal.h"
#include "intreadwrite.h"
#include "macros.h"
#include "mem.h"

#ifdef MALLOC_PREFIX

#define malloc
#define memalign
#define posix_memalign
#define realloc
#define free

void *malloc(size_t size);
void *memalign(size_t align, size_t size);
int   posix_memalign(void **ptr, size_t align, size_t size);
void *realloc(void *ptr, size_t size);
void  free(void *ptr);

#endif /* MALLOC_PREFIX */

#define ALIGN

#define FF_MEMORY_POISON

/* NOTE: if you want to override these functions with your own
 * implementations (not recommended) you have to link libav* as
 * dynamic libraries and remove -Wl,-Bsymbolic from the linker flags.
 * Note that this will cost performance. */

static atomic_size_t max_alloc_size =;

/* Set to 0 to remove the maximum allocation size. */
void av_max_alloc(size_t max){}

static int size_mult(size_t a, size_t b, size_t *r)
{}

void *av_malloc(size_t size)
{}

void *av_realloc(void *ptr, size_t size)
{}

void *av_realloc_f(void *ptr, size_t nelem, size_t elsize)
{}

int av_reallocp(void *ptr, size_t size)
{}

void *av_malloc_array(size_t nmemb, size_t size)
{}

void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
{}

int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
{}

void av_free(void *ptr)
{}

void av_freep(void *arg)
{}

void *av_mallocz(size_t size)
{}

void *av_calloc(size_t nmemb, size_t size)
{}

char *av_strdup(const char *s)
{}

char *av_strndup(const char *s, size_t len)
{}

void *av_memdup(const void *p, size_t size)
{}

int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
{}

void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem)
{}

void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
                       const uint8_t *elem_data)
{}

static void fill16(uint8_t *dst, int len)
{}

static void fill24(uint8_t *dst, int len)
{}

static void fill32(uint8_t *dst, int len)
{}

void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
{}

void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{}

static inline void fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc)
{}

void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
{}

void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size)
{}

int av_size_mult(size_t a, size_t b, size_t *r)
{}