heap.cc

来自「VRTX 商用嵌入式实时操作系统」· CC 代码 · 共 63 行

CC
63
字号
/***************************************************************************
*
*		Copyright (c) 1993 READY SYSTEMS CORPORATION.
*
*	All rights reserved. READY SYSTEMS' source code is an unpublished
*	work and the use of a copyright notice does not imply otherwise.
*	This source code contains confidential, trade secret material of
*	READY SYSTEMS. Any attempt or participation in deciphering, decoding,
*	reverse engineering or in any way altering the source code is
*	strictly prohibited, unless the prior written consent of
*	READY SYSTEMS is obtained.
*
*
*	Module Name:		heap.cc
*
*	Identification:		@(#) 1.3 heap.cc
*
*	Date:			4/26/93  17:15:23
*
****************************************************************************
*/

#include "heap.h"

Heap::Heap (void *base, unsigned length, unsigned page_log2)
{
  int err;
  hid = sc_hcreate ((char *) base, length, page_log2, &err);
}

Heap::~Heap ()
{
  int err;
  sc_hdelete (hid, 1, &err);
}

void *
Heap::malloc (unsigned size)
{
  int err;
  return (void *) sc_halloc (hid, size, &err);
}

void
Heap::free (void *ptr)
{
  int err;
  sc_hfree (hid, (char *) ptr, &err);
}

void
Heap::inquiry (int info[3])
{
  int err;
  sc_hinquiry (info, hid, &err);
}

int
Heap::id ()
{
  return hid;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?