[rk_malloc]: add rk_malloc unit test for linux

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@28 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming 2015-08-05 02:23:57 +00:00
parent c0c5222152
commit 9606779e00
2 changed files with 31 additions and 0 deletions

View File

@ -17,6 +17,8 @@
#ifndef __RK_MALLOC_H__
#define __RK_MALLOC_H__
#include <stdlib.h>
#define rk_malloc(type, count) (type*)rk_mpp_malloc(sizeof(type) * (count))
#define rk_free(ptr) rk_mpp_free(ptr)

29
osal/linux/os_malloc.c Normal file
View File

@ -0,0 +1,29 @@
/*
* Copyright 2010 Rockchip Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "os_malloc.h"
int os_malloc(void **memptr, size_t alignment, size_t size)
{
return posix_memalign(memptr, alignment, size);
}
void os_free(void *ptr)
{
free(ptr);
}