Files
mpp/osal/android/os_mem.c
Herman Chen ca061993ef refactor[osal]: Refactor C++ osal file to C
1. Refactor osal cpp files to c.
2. Update osal license to Apache-2.0 OR MIT.
3. Remove windows support.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ic5545d861676880f7a6247515404d585cd4fcef5
2025-09-02 17:49:14 +08:00

39 lines
688 B
C

/* SPDX-License-Identifier: Apache-2.0 OR MIT */
/*
* Copyright (c) 2015 Rockchip Electronics Co., Ltd.
*/
#if defined(__ANDROID__)
#include <stdlib.h>
#include "os_mem.h"
int os_malloc(void **memptr, size_t alignment, size_t size)
{
(void)alignment;
int ret = 0;
void *ptr = malloc(size);
if (ptr) {
*memptr = ptr;
} else {
*memptr = NULL;
ret = -1;
}
return ret;
//return posix_memalign(memptr, alignment, size);
}
int os_realloc(void *src, void **dst, size_t alignment, size_t size)
{
(void)alignment;
*dst = realloc(src, size);
return (*dst) ? (0) : (-1);
}
void os_free(void *ptr)
{
free(ptr);
}
#endif